SQL grouping query question; evaluating a group of rows based on the value of one field.
Posted
by user324575
on Stack Overflow
See other posts from Stack Overflow
or by user324575
Published on 2010-04-23T20:26:43Z
Indexed on
2010/04/23
20:43 UTC
Read the original article
Hit count: 146
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.
© Stack Overflow or respective owner