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

Query table A and return records not found in table B. Please help? 1

Status
Not open for further replies.

casabella

Programmer
Aug 30, 2007
59
US
Given table A and table B. Table A is a master table and table B is a list of authority or reference which is fed by selecting records from table A (via an UI I wrote in PHP).

The interface is working fine but I am left with one problem. If I need to edit my table of authority, the source table (table A) should return ONLY entries not previously selected.

That said, if the A.key is in B.key, records from table A matching B.key should be omitted.

I could do this by looping through the query results from table A and querying table B, if no match, show A.key. This I think is a bit antiquated and possibly too involved.

Is there a joint query command I can use?

Thanks,


Jose
 
Code:
select A.key
  from tableA as A
left outer
  join tableB as B
    on B.key = A.key
 where B.key is null

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top