From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, adt09(at)dial(dot)pipex(dot)com |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] Relating 1 table to another. |
Date: | 1999-04-29 11:00:22 |
Message-ID: | l03130303b34debfbb5b1@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
At 19:47 +0300 on 25/04/1999, Tom Lane wrote:
>
> This is where you need table aliases (AS clauses). You do it like this:
>
> select project.id, project.name, p1.name, p2.name
> from project, people as p1, people as p2 where
> project.mainpersonid = p1.id and project.standbypersonid = p2.id;
No, AS is for field aliasing, not table aliasing.
The proper syntax is
SELECT project.id, project.name, p1.name, p2.name
FROM project, people p1, people p2
WHERE project.mainpersonid = p1.id
AND project.standbypersonid = p2.id;
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
From | Date | Subject | |
---|---|---|---|
Next Message | José Soares | 1999-04-29 13:28:16 | Re: [SQL] LIMIT |
Previous Message | Herouth Maoz | 1999-04-29 10:28:38 | Re: [SQL] Finding the "most recent" rows |