Re: Simplyfying many equals in a join

From: "cnliou" <cnliou(at)so-net(dot)net(dot)tw>
To: "" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Simplyfying many equals in a join
Date: 2004-02-26 09:37:22
Message-ID: 1077788242.37142.cnliou@so-net.net.tw
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Is there a shorthand notation when performing a multi-table join and one
>column is to be equaled in all tables?

Is this you are looking for?

SELECT t1.c7,t2.c6
FROM t1,t2
USING (c1,c2,c3)
WHERE t1.c4='2004-2-28' AND t2.c5='xyz'

performs the same as

SELECT t1.c7,t2.c6
FROM t1,t2
WHERE t1.c1=t2.c1 and t1.c2=t2.c2 and t1.c3=t2.c3
and t1.c4='2004-2-28' AND t2.c5='xyz'

CN

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jennifer Lee 2004-02-26 10:35:26 help using arrays in a function
Previous Message Shachar Shemesh 2004-02-26 09:31:57 Re: Windows Library for libpq