From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | sqllist <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Outer Joins |
Date: | 2000-11-01 17:01:28 |
Message-ID: | 3A004C68.C0F5758C@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Marc,
> select a.col1, b.col2 from a,b
> where a.col1 = b.col2
> or b.col2 is null
The above would select each record in a that matched a record in b, plus
each record in b for every possible a where b.col2 was null - not where
there was no match.
> select a.col1, b.col2 from a,b
> where a.col1 = b.col2
> or a.col1 not in (select b.col2 from b)
This would work, but it would be *much* slower than a UNION query. "Not
In" queries are perhaps the slowest you can run; see the earlier thread
"Query Problem" for a discussion. UNION queries are, in fact, very fast
... just awkward to code and manipulate.
-Josh
--
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 436-9166
for law firms, small businesses fax 436-0137
and non-profit organizations. pager 338-4078
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Najm Hashmi | 2000-11-01 17:56:26 | Re: INSERT [IGNORE] INTO TABLE |
Previous Message | Stephan Szabo | 2000-11-01 16:50:06 | Re: Problem with coalesce.. |