Re: INNER JOINS in 7.0.3 & 7.1.3

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Stuart Grimshaw <stuart(dot)pgsql(at)smgsystems(dot)co(dot)uk>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: INNER JOINS in 7.0.3 & 7.1.3
Date: 2001-10-30 16:23:59
Message-ID: B804222E.5B62%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

IIRC You can't have multiple join clauses, per se, but you can "chain"
joins. I am not sure how that is done with a self join, but since inner
joins are implicit why not just:

SELECT a.name as hometeam, c.name as homemanager, c.email as homeemail,
b.name as awayteam, d.name as awaymanager, d.email as awayemail
FROM teams a, managers c, teams b, managers d
where a.managerid = c.managerid AND b.managerid = d.managerid AND a.teamid =
13 AND b.teamid = 15;

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: Stuart Grimshaw <stuart(dot)pgsql(at)smgsystems(dot)co(dot)uk>
> Date: Tue, 30 Oct 2001 15:16:53 +0000
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] INNER JOINS in 7.0.3 & 7.1.3
>
> I have a DB in 7.1.3 that I am trying to downgrade to 7.0.3, and I've run
> into a little problem with INNER JOINS.
>
> This query (just as an example) causes an error :
>
> SELECT a.name as hometeam, c.name as homemanager, c.email as homeemail,
> b.name as awayteam, d.name as awaymanager, d.email as awayemail FROM teams AS
> a INNER JOIN managers AS c ON (a.managerid = c.managerid), teams AS b INNER
> JOIN managers as d ON (b.managerid = d.managerid) where a.teamid = 13 AND
> b.teamid = 15;
>
> The error being:
> ERROR: parser: parse error at or near ","
>
> A query with a single inner join works fine. I've checked the changes file
> for 7.1 on the website, but I can't find INNER JOINS mentioned as being
> something that changed.
>
> Can anyone shed any light on this for me?
>
> --
>
> | Stuart Grimshaw <stuart(at)footballnet(dot)com>
> | Chief Operations Officer
> | Football Networks Ltd
> |-
> | t:07976 625221
> | f:0870 7060260
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart Grimshaw 2001-10-30 16:37:04 Re: INNER JOINS in 7.0.3 & 7.1.3
Previous Message Tom Lane 2001-10-30 16:04:36 Re: INNER JOINS in 7.0.3 & 7.1.3