I have price table with three columns id,price,product_id. product_id can contain multiple prices. I have to get lowest price product_id when query perform in mysql, but I am not getting as expected.
My Mysql fiddle query link:
mysql fiddle link
In this table product_id 101 has 4999 as low value but I am getting another price 5000
SELECT id,min(price),product_id FROM price pr WHERE price >= 2000 AND price <= 15000 group by product_id order by price ASC