Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding missing records using where not exists

Status
Not open for further replies.

gemoon

Programmer
Mar 22, 2002
55
US
im trying to write a query that returns missing records. im sure this is probably a simple task, but with my minimal understanding of queries i havent been able to come up with a solution.

i have three tables.
tblA: aID, a
tblB: aID, cID
tblC: c, cID

tblA and tblC are 1:many in relationship to tblB

for every record in tblA i am trying to retrieve the cID's missing from tblB

for example if the data is:
tblA:
a aID
Red 1
Blue 2

tblB:
aID cID
1 2
1 3
2 2

tblC:
c cID
Cat 2
Dog 3

the query would retrieve that Blue is missing a Dog record in tblB.

ive searched this forum and others and think the solution lies in a "not exists" statement, but im not sure exactly how to structure it.

any advice anyone can give me would be greatly appreciated.
Ed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top