Re: RE: [SQL] Why *no* ambig.uous complain in select part? - Mailing list pgsql-sql

From Mark Roberts
Subject Re: RE: [SQL] Why *no* ambig.uous complain in select part?
Date
Msg-id 1219440839.6163.211.camel@localhost
Whole thread Raw
In response to Re: RE: [SQL] Why *no* ambig.uous complain in select part?  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-sql
On Fri, 2008-08-22 at 17:10 -0400, Emi Lu wrote:
> 
> Would you please give me an example?
> 
> I have two tables like the following:
> T1 (col1 varchar, col2 varchar, primary key (col1, col2))
> T2 (col1 varchar, col2 varchar, primary key (col1, col2))
> 
> 
> Query I have is:
> ===================
> select col1, col2
> from      T1
> left join T2 using (T1, T2);
> 
> Thanks a lot!

If (T1.col1, T1.col2) != (T2.col1, T2.col2) then the join is
unsuccessful and T2.col1 and T2.col2 will be null.  If you're wondreing
if the join was successful:

select col1, col2
from T1   left outer join T2 using (col1, col2)
where T2.col1 is not null

-Mark



pgsql-sql by date:

Previous
From: Emi Lu
Date:
Subject: Re: RE: [SQL] Why *no* ambig.uous complain in select part?
Next
From: Tom Lane
Date:
Subject: Re: Why *no* ambig·uous complain in select part?