Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 5637C2E30D5 for ; Fri, 25 Jan 2008 12:23:58 -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 95865-09 for ; Fri, 25 Jan 2008 12:23:54 -0400 (AST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.224]) by postgresql.org (Postfix) with ESMTP id DC1642E30EF for ; Fri, 25 Jan 2008 12:23:54 -0400 (AST) Received: by wx-out-0506.google.com with SMTP id r21so548750wxc.28 for ; Fri, 25 Jan 2008 08:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=R8jDmxSHTEhFoMswRgc0a3lXEElktyddy9UCCbxGNKA=; b=bJVtgKZ7kKvgLbmUSDEOWzScRKFOVU1cLEkM8KfcZX1DTQ9p/6ZibkigqeTL2FNWUneCNGKGmjbsctuDkc9ZIUN4GrELRVb6xNG62SGJAUb2W1OxYt0psuBoyFmF/iFyb9owIJEUA6eS1hpvNhZs8u76/OXEwfzGjxPppZmQ5Xo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=xCgaW5C04Mvl3mkUv7frO+zShu3np93oCgTwH2FRgVPLtmym0EQgKHjWszEzm44dt0r8/5iJkynPTUdjjd9g209zOpJBKaioPzp6BpWWbdl9vgmUoQn7csjcXVlKtThdq303P/PSbe5u5Efn36k+cPzdklWlLs8fUbcQS76zak4= Received: by 10.142.231.7 with SMTP id d7mr1330955wfh.194.1201278233612; Fri, 25 Jan 2008 08:23:53 -0800 (PST) Received: by 10.142.165.8 with HTTP; Fri, 25 Jan 2008 08:23:53 -0800 (PST) Message-ID: Date: Fri, 25 Jan 2008 10:23:53 -0600 From: "Scott Marlowe" To: "acec acec" Subject: Re: This SQL works under Mysql, not Postgresql. Cc: pgsql-sql@postgresql.org In-Reply-To: <692719.53428.qm@web63009.mail.re1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <692719.53428.qm@web63009.mail.re1.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/195 X-Sequence-Number: 30048 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 = 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? Is that legal SQL? I've never seen anything like that before...