SQL grouping query question; evaluating a group of rows based on the value of one field.
- by user324575
I've got table vendorparts that lists all my parts and their vendor(s). Parts with multiple vendors have multiple records in this table. I'm trying to write a query that only returns the partid, and vendor of parts that do not have a default vendor assigned.
Partid Vendor Defaultflag
1 A 1
2 B 0
2 C 0
3 D 0
3 E 0
3 F 1
4 G 0
I would like to return the following:
Partid Vendor
2 A
2 B
4 G
I'm obviously having issues with partid 3 and getting the query to see it as having a default vendor assigned.