X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 25DE330F07F for ; Tue, 17 Jun 2003 18:56:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 72844-04 for ; Tue, 17 Jun 2003 15:56:14 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id CBDCE30EF55 for ; Tue, 17 Jun 2003 15:56:13 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h5HIt84w011978; Tue, 17 Jun 2003 12:55:08 -0600 (MDT) Date: Tue, 17 Jun 2003 12:53:48 -0600 (MDT) From: "scott.marlowe" To: Jodi Kanter Cc: Postgres SQL List Subject: Re: join syntax In-Reply-To: <3EEF6170.1040905@virginia.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200306/203 X-Sequence-Number: 13961 On Tue, 17 Jun 2003, Jodi Kanter wrote: > One of my colleagues has created a database where he has the same field > name in two tables and uses this field to link his tables rather than > some arbitrary value. For example, he has used "exp_id" in two tables. > When writing his joins he uses a syntax that says something like JOIN ON > EXP_ID. Can someone tell me what that syntax should be? I am not very > familiar with it since I typically use the syntax where one field is set > equal to the other. > Personally I prefer not to set databases up this way but cannot seem to > convince him of this. And yet I am supposed to now help him with his > database and application.. Is there some documentation that would define > this type of syntax? How is this handled if you have more than one table > in the join? It does not appear that this format would allow for this. If you're joining two tables on a field that has the same name you can use a natural join. select * from table1 natural join table2;