Re: [SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread acec acec
Maybe it is not legal sql according to SQL standard,
but it works under mysql, I try to port it into
Postgresql.

--- Scott Marlowe <[EMAIL PROTECTED]> wrote:

> On Jan 25, 2008 10:11 AM, acec acec
> <[EMAIL PROTECTED]> 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 = 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 =
> '1';
> > 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?
> 
> Is that legal SQL?  I've never seen anything like
> that before...
> 



  Connect with friends from any web browser - no download required. Try the 
new Yahoo! Canada Messenger for the Web BETA at 
http://ca.messenger.yahoo.com/webmessengerpromo.php

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[SQL] This SQL works under Mysql, not Postgresql.

2008-01-25 Thread acec acec
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 = '1';
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/


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match