Skip site navigation (1) Skip section navigation (2)

This SQL works under Mysql, not Postgresql.

From: acec acec <tomcatacec(at)yahoo(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: This SQL works under Mysql, not Postgresql.
Date: 2008-01-25 16:11:53
Message-ID: 692719.53428.qm@web63009.mail.re1.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-sql
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 = s.SUB_ACCOUNT_ID) LEFT JOIN (SERVICE suv,
SERVICE sus) ON (sa.ID = suv.SUB_ACC_ID AND
suv.SERVICE_ID = 0 AND sa.ID = sus.SUB_ACC_ID AND
sus.SERVICE_ID = 1) WHERE s.TELEPHONE = '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?

Thanks in advance.



      Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/


Responses

pgsql-sql by date

Next:From: Gary StainburnDate: 2008-01-25 16:15:58
Subject: regex_replace problem
Previous:From: PostgreSQL AdminDate: 2008-01-25 16:02:34
Subject: Unclosed connections

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group