This is a product table and have few million of records.
I want to lis
SELECT store_id,id,product_name FROM table_name WHERE id IN (SELECT MAX(id) FROM table_name GROUP BY store_id) ORDER BY id
this should work and you can Order by as per your req either by store_id or id.