Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Search for missing values in SQL. Advanced Query

$
0
0
KEY ID GROUP
1 1 a
2 1 b
3 2 a
4 2 b
5 3 a
6 3 b
7 4 a
8 5 a

This is my simple table I need a query that will identity the ID's that are missing the group "b" but I don't want ID 1,2,3 to come up because they are part of a and b. I just need to see anything missing only "b" but not if it's part of a and b.

query should reveal answer should be missing the group b
KEY ID
7 4
8 5

I tried the NULL search but since the records dont exist it cant find a null. Any help on writing a query to identify the missing ID without B but exclude ID that are part of A and B

Hope this makes sense, Please help.

Viewing all articles
Browse latest Browse all 13329

Trending Articles