What I am trying to do is that I have two different tables and joining them by a column. The result im looking for is retrieving all of the records that are NOT in the in the first table. I cant remember the sytax to do this. Here is what I have so far:
SELECT A.ICAO, A.IATA, A.AIRPORT_NAME, A.CITY, A.COUNTRY, A.REVISED_DATE
FROM AIRPORT_CHECKLIST A, AIRPORT_CHECKLIST_SELECTED B
WHERE A.COMPANY = 'TOM'
AND A.ICAO <> B.ICAO
To find all records without a match, do a left inner join (which returns one record for each record in the left-hand table, even if it doesn’t have a match in the right-hand table) and check for null values in the right-hand table’s fields. Assuming you’re looking for airports in the checklist for
'TOM'that are not selected:The test
B.ICAO IS NULLselects only those rows that have been inserted by the inner join to representArows with no matchingBrow