X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 691D09FA5C8 for ; Thu, 8 Jun 2006 12:56:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 71438-07 for ; Thu, 8 Jun 2006 12:56:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from he100.hostelement.com (unknown [64.246.26.51]) by postgresql.org (Postfix) with ESMTP id A30FE9F9EF3 for ; Thu, 8 Jun 2006 12:56:50 -0300 (ADT) Received: from [64.213.65.29] (helo=[127.0.0.1]) by he100.hostelement.com with esmtpa (Exim 4.52) id 1FoMsF-0007W8-Bl; Thu, 08 Jun 2006 11:56:43 -0400 Message-ID: <448848B8.8010406@oisinglynn.com> Date: Thu, 08 Jun 2006 11:56:40 -0400 From: Oisin Glynn User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: George Handin CC: pgsql-sql@postgresql.org Subject: Re: Concat two fields into one at runtime References: <44884736.3080309@dafunks.com> In-Reply-To: <44884736.3080309@dafunks.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - he100.hostelement.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - oisinglynn.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/99 X-Sequence-Number: 25335 George Handin wrote: > Is there a way using built-in PostgreSQL functions to combine two data > fields into a single field at runtime when querying data? > > For example, the query now returns: > > id first last > --- ------- ---------- > 1 Goerge Handin > 2 Joe Rachin > > I'd like it to return: > > id name > --- ------------------- > 1 George Handin > 2 Joe Rachin > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings if you want the 2 fields with a space between them select first ||' '||last as name from foo; should do it. Oisin