Subject Re: [firebird-support] Outer Joins
Author Arno Brinkman
Hi TIm,

> I know that this is a simple question, and that I should know the answer
> ... but I don't. *blush*

Just use EXISTS

> Given two tables, how do I write a select that will show me all the
records
> that are in Table1 but NOT in Table2?
>
> CREATE TABLE TABLE1
> (
> RECORDNO INTEGER NOT NULL,
> SEQUENCENUMBER INTEGER,
> PRIMARY KEY(RECORDNO)
> );
>
> CREATE TABLE TABLE2
> (
> RECORDNO INTEGER NOT NULL,
> SEQUENCENUMBER INTEGER,
> PRIMARY KEY(RECORDNO)
> );
>
> In this example, assume that I want to find all of the records in Table1
> where there is no matching record in Table2.

SELECT
t1.*
FROM
TABLE1 t1
WHERE
NOT EXISTS(SELECT * FROM TABLE2 t2
WHERE t2.RECORDNO = t1.RECORDNO)


Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/


Nederlandse firebird nieuwsgroep :
news://80.126.130.81