Subject | Re: [firebird-support] Outer Joins |
---|---|
Author | Arno Brinkman |
Post date | 2003-11-13T08:49:19Z |
Hi TIm,
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
> I know that this is a simple question, and that I should know the answerJust use EXISTS
> ... but I don't. *blush*
> Given two tables, how do I write a select that will show me all therecords
> that are in Table1 but NOT in Table2?SELECT
>
> 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.
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