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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select records that are NOT in a table

Status
Not open for further replies.

agpvoodoo2

Programmer
Mar 29, 2006
1
US
I'm having trouble getting the right records from my database to do a script to have two select boxes where you can move cities from one to the other and vice versa.

I have 3 tables, one table is a record of people, one is a record of cities in the country and the third is bridge table for the people and city, so I'm logged in it will show what cities I've been to.

If I have 4 possible cities(CA, LA, DC, NYC)

So I can select the cities I've been to with
SELECT tblperson.ID
FROM tblperson LEFT JOIN tblbridge ON tblperson.ID = tblbridge.personID
WHERE tblbridge.cityID

this gives me DC, NYC

but is there a statement I can use to select the ones that I have NOT been to.

 
WHERE tblbridge.personID Is Null

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top