Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.1) with ESMTP id HAA50741 for ; Thu, 29 Apr 1999 07:00:14 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id E04494BC19; Thu, 29 Apr 1999 14:00:02 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA720B; Thu, 29 Apr 1999 14:02:05 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <10858.925058869@sss.pgh.pa.us> References: Your message of Sun, 25 Apr 1999 08:10:07 PDT <1700710081999.925053007172.497941124.adt09@dial.pipex.com.MailpuccinoKong EuTak> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 29 Apr 1999 14:00:22 +0300 To: Tom Lane , adt09@dial.pipex.com From: Herouth Maoz Subject: Re: [SQL] Relating 1 table to another. Cc: pgsql-sql@postgreSQL.org 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