SQL newbie. Can't think how to search for this so I'll just ask in hopes that someone is patient enough to answer:
In a table called "products" I have 2 fields:
item_code menu_name
1 chairs
2 chairs
3 tables
4 tables
5 tables
6 desks
7 benches
8 benches
item_codes are all unique, while menu_names can repeat. I can SELECT DISTINCT from menu_name to get:
chairs
tables
desks
benches
but I also want each distinct menu_name's first item_code to come along with it so I get:
1, chairs
3, tables
6, desks
7, benches
Thanks all.
In a table called "products" I have 2 fields:
item_code menu_name
1 chairs
2 chairs
3 tables
4 tables
5 tables
6 desks
7 benches
8 benches
item_codes are all unique, while menu_names can repeat. I can SELECT DISTINCT from menu_name to get:
chairs
tables
desks
benches
but I also want each distinct menu_name's first item_code to come along with it so I get:
1, chairs
3, tables
6, desks
7, benches
Thanks all.