pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: adt09@dial.pipex.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Relating 1 table to another.
Date: Thu, 29 Apr 1999 14:00:22 +0300
Message-ID: <l03130303b34debfbb5b1@[147.233.159.109]> (raw)
In-Reply-To: <10858.925058869@sss.pgh.pa.us>
References: <1700710081999.925053007172.497941124.adt09@dial.pipex.com.MailpuccinoKong EuTak>

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





view thread (3+ messages)

Message-ID: <l03130303b34debfbb5b1@[147.233.159.109]>
Permalink:  ../l03130303b34debfbb5b1@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130303b34debfbb5b1@[147.233.159.109]

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: herouth@oumail.openu.ac.il, tgl@sss.pgh.pa.us, adt09@dial.pipex.com
  Subject: Re: [SQL] Relating 1 table to another.
  In-Reply-To: <l03130303b34debfbb5b1@[147.233.159.109]>
  References: <l03130303b34debfbb5b1@[147.233.159.109]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox