I want to select the exact id of the minprice in mysql query below in my mysql query
Select min(p.Price) as minprice,GROUP_CONCAT(p.vendor_id) as v_ids,p.*
from my_table as p GROUP BY `SKU` order by Price ASC
I also tried this
Select min(p.Price) as minprice,
GROUP_CONCAT(p.PRODUCT_ID) as IDS,
GROUP_CONCAT(p.Price) as prices,
GROUP_CONCAT(p.vendor_id) as v_ids,p.* from `my_table` as p
GROUP BY `SKU` order by Price ASC
but it does not help me out
Please to get the id of minprice
Thanks in advance
SELECT MT.* FROM MY_TABLE MT
INNER JOIN
(
SELECT PRODUCT_ID ID,SKU,MIN(P.PRICE) FROM MY_TABLE GROUP BY PRODUCT_ID,SKU
)Z ON Z.ID=MT.PRODUCT_ID AND Z.SKU=MT.SKU
You can try above code.
This will helps you.