Re: RE: [SQL] Why *no* ambig.uous complain in select part?
- From: Mark Roberts <mailing_lists(at)pandapocket(dot)com>
- To: emilu(at)encs(dot)concordia(dot)ca
- Cc: Luigi Castro Cardeles <luigi(dot)cardeles(at)gmail(dot)com>, PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>
- Subject: Re: RE: [SQL] Why *no* ambig.uous complain in select part?
- Date: Fri, 22 Aug 2008 14:33:59 -0700
- Message-id: <1219440839.6163.211.camel@localhost> <text/plain>
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
Home |
Main Index |
Thread Index