Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 756492E36B0 for ; Fri, 25 Jan 2008 12:53:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 89930-01 for ; Fri, 25 Jan 2008 12:53:01 -0400 (AST) Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by postgresql.org (Postfix) with ESMTP id 1E25B2E37A6 for ; Fri, 25 Jan 2008 12:53:00 -0400 (AST) Received: from suite (suite.marktest.pt [10.61.90.236]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id DQZTY1RK; Fri, 25 Jan 2008 16:52:57 -0000 Message-ID: <012101c85f72$b92ca380$ec5a3d0a@marktestcr.marktest.pt> From: "Oliveiros Cristina" To: "Scott Marlowe" , "acec acec" Cc: References: <692719.53428.qm@web63009.mail.re1.yahoo.com> Subject: Re: This SQL works under Mysql, not Postgresql. Date: Fri, 25 Jan 2008 16:52:51 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_011E_01C85F72.B90B38D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/199 X-Sequence-Number: 30052 This is a multi-part message in MIME format. ------=_NextPart_000_011E_01C85F72.B90B38D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Neither have I. The LEFT JOIN I know is something like=20 SELECT ... FROM table1 LEFT OUTER JOIN table2 ON .... Try using this construct Best, Oliveiros ----- Original Message -----=20 From: "Scott Marlowe" To: "acec acec" Cc: Sent: Friday, January 25, 2008 4:23 PM Subject: Re: [SQL] This SQL works under Mysql, not Postgresql. > On Jan 25, 2008 10:11 AM, acec acec wrote: >> I have the following sql, which works fine under mysql >> database: >> SELECT sa.ID, suv.TOTAL as VOICE_TOTAL, sus.TOTAL as >> SMS_TOTAL FROM SUB_ACCOUNT sa INNER JOIN SUBSCRIBER s >> ON (sa.ID =3D s.SUB_ACCOUNT_ID) LEFT JOIN (SERVICE suv, >> SERVICE sus) ON (sa.ID =3D suv.SUB_ACC_ID AND >> suv.SERVICE_ID =3D 0 AND sa.ID =3D sus.SUB_ACC_ID AND >> sus.SERVICE_ID =3D 1) WHERE s.TELEPHONE =3D '111111111'; >> When I ran it under postgresql, which gave me "ERROR: >> syntax error at or near" >> It looks like I could not put two table on LEFT JOIN: >> LEFT JOIN (SERVICE suv, SERVICE sus) >> >> Do you have any suggestion for this problem? >=20 > Is that legal SQL? I've never seen anything like that before... >=20 > ---------------------------(end of = broadcast)--------------------------- > TIP 4: Have you searched our list archives? >=20 > http://archives.postgresql.org > ------=_NextPart_000_011E_01C85F72.B90B38D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Neither have I.
 
The LEFT JOIN I know is something like=20
SELECT ...
FROM table1
LEFT OUTER JOIN = table2
ON ....
 
Try using this construct
 
Best,
Oliveiros
 
 
----- Original Message -----
From: "Scott Marlowe" <scott.marlowe@gmail.com>
To: "acec acec" <tomcatacec@yahoo.ca>
Cc: <pgsql-sql@postgresql.org>
Sent: Friday, January 25, 2008 4:23 = PM
Subject: Re: [SQL] This SQL works under = Mysql, not=20 Postgresql.

> On Jan 25, 2008 10:11 AM, acec acec <tomcatacec@yahoo.ca>=20 wrote:
>> I have the following sql, which works fine under=20 mysql
>> database:
>> SELECT sa.ID, suv.TOTAL as = VOICE_TOTAL,=20 sus.TOTAL as
>> SMS_TOTAL FROM SUB_ACCOUNT sa INNER JOIN = SUBSCRIBER=20 s
>> ON (sa.ID =3D s.SUB_ACCOUNT_ID) LEFT JOIN (SERVICE = suv,
>>=20 SERVICE sus) ON (sa.ID =3D suv.SUB_ACC_ID AND
>> suv.SERVICE_ID = =3D 0 AND=20 sa.ID =3D sus.SUB_ACC_ID AND
>> sus.SERVICE_ID =3D 1) WHERE = s.TELEPHONE =3D=20 '111111111';
>> When I ran it under postgresql, which gave me=20 "ERROR:
>> syntax error at or near"
>> It looks like I = could=20 not put two table on LEFT JOIN:
>> LEFT JOIN (SERVICE suv, = SERVICE=20 sus)
>>
>> Do you have any suggestion for this=20 problem?
>
> Is that legal SQL?  I've never seen = anything like=20 that before...
>
> ---------------------------(end of=20 broadcast)---------------------------
> TIP 4: Have you searched = our list=20 archives?
>=20
>           = ;   =20
http://archives.postgresql.org
> ------=_NextPart_000_011E_01C85F72.B90B38D0--