hello i have a table with the following structure:
sku, category, brand, product_name, inventory_count
with the following data:
1001, car, honda, "honda car 1", 5
1002, truck, honda, "honda truck 1", 6
1003, car, ford, "ford car 1", 7
1004, truck, ford, "ford truck 1", 8
1005, bike, honda, "honda bike 5", 9
1006, bike, ford, "ford bike 6", 10
I'm using the following SQL query
select distinct category from products
this would return the following:
car
truck
bike
this works great,
Now I want to get just one product example for each of the categories with the greatest INVENTORY_COUNT
so that it returns the data as:
car, "ford car 1"
truck, "ford truck 1"
bike, "ford bike 6"
what SQL query would i run to get that data??
i want the item with the greater INVENTORY_COUNT for each category
thanks!!