How to get rows with lowest value from a group by?
Hi Experts
I have a database of beverages, with following tables:
Beverage (code, name, size) Primary key=code
Store (name, area, phone) Primary key=name
Sells (store_name, code, price) store_name refers to name(store) and code to code(beverage).
I need to find the code and name of the least expensive beverages for each store (1 value per store), but I am only able to find minimum price per store without the code via:
SELECT store_name, MIN(price) FROM Sells GROUP BY store_name ORDER BY...
How to get rows with lowest value from a group by?
Hi Experts
I have a database of beverages, with following tables:
Beverage (code, name, size) Primary key=code
Store (name, area, phone) Primary key=name
Sells (store_name, code, price) store_name refers to name(store) and code to code(beverage).
I need to find the code and name of the least expensive beverages for each store (1 value per store), but I am only able to find minimum price per store without the code via:
SELECT store_name, MIN(price) FROM Sells GROUP BY store_name ORDER BY...
How to get rows with lowest value from a group by?