Re: nested select statement syntax error
Easy!
SELECT orderno
FROM orders o
LEFT JOIN temporder t
ON o.orderno = t.orderno
WHERE t.orderno IS NULL
Like the INNER JOIN operator, the LEFT JOIN operator combines all records from the two table operands and retains those combinations for which the ON condition is true.
The difference is, that if the record from 'left' table (the table appearing left of the INNER JOIN operator) does not match any of the records in the right table (the table appearing right the INNER JOIN operator) it retains the left record, and makes up a virtual record for the right table composed out of NULLs. So, it's "match if you can, but don't lose the record if you can't".
Now, by adding the WHERE t.orderno IS NULL, we are effectively filtering out all the records that matched, retaining those that can't match.
Good luck!
Subject
Written By
Posted
Re: nested select statement syntax error
August 24, 2005 02:04AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.