X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D8AF052952 for ; Wed, 10 Aug 2005 20:09:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54294-02 for ; Wed, 10 Aug 2005 23:09:03 +0000 (GMT) Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net [199.185.220.220]) by svr1.postgresql.org (Postfix) with ESMTP id 30E4A52946 for ; Wed, 10 Aug 2005 20:09:01 -0300 (ADT) Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20050810230904.GCWT26622.priv-edtnes56.telusplanet.net@localhost> for ; Wed, 10 Aug 2005 17:09:04 -0600 Received: from 209.17.183.249 ( [209.17.183.249]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Wed, 10 Aug 2005 16:09:04 -0700 Message-ID: <1123715344.42fa89104f121@webmail.telus.net> Date: Wed, 10 Aug 2005 16:09:04 -0700 From: Mischa Sandberg To: pgsql-sql@postgresql.org Subject: Re: How to alias table columns in result? References: <1745503505081015455e79f284@mail.gmail.com> In-Reply-To: <1745503505081015455e79f284@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 209.17.183.249 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.054 tagged_above=0 required=5 tests=[AWL=-0.372, DNS_FROM_RFC_POST=1.376, FORGED_RCVD_HELO=0.05] X-Spam-Level: * X-Archive-Number: 200508/52 X-Sequence-Number: 22280 Quoting nori : > Hi, > > If I have: > 1.) table car with columns index and name > 2.) table driver with columns index, name and car_index > > and query: > SELECT d.*, c.* FROM driver as d LEFT OUTER JOIN car AS c ON > d.car_index=c.index; > > How can I get results that have distinct names for columns (ex. > d.name, d.index, c.name, c.index,...)? Here's where you have to get explicit; d.* won't work. If you want to have names with (.) in them, they have to be quoted, too. Me, I'd use "d_name, d_index, c_name, ..." SELECT d.name as "d.name", d.index as "d.index", c.name as "c.name", ...