Subject Re: [ib-support] Self left join
Author Svein Erling Tysvaer
Bob,

At 23:49 10.04.2003 +0200, you wrote:
>select
> p1.name, p2.name
>from
> products p1
> left join products p2 on (p2.name = p1.name and p2.account_id = 2)
>where
> p1.account_id = 1

Arno is (as always) right, but I still find this pretty confusing. Why
would anyone want a left outer join just to select the name that is joining
the tables twice? This query just seems to be synonymous with

select
name, (select 1 from products p2 where p2.name = p1.name and
p2.account_id = 2)
from products p1
where
p1.accound_id = 1

with the exception that the former select will produce multiple duplicate
rows if there is more than one matching row with account_id = 2.

Set
-even I will go to Fulda (www.firebird-conference.com)