pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oisin Glynn <me@oisinglynn.com>
To: George Handin <postgresql@dafunks.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Concat two fields into one at runtime
Date: Thu, 08 Jun 2006 11:56:40 -0400
Message-ID: <448848B8.8010406@oisinglynn.com> (raw)
In-Reply-To: <44884736.3080309@dafunks.com>
References: <44884736.3080309@dafunks.com>

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




view thread (5+ messages)

Message-ID: <448848B8.8010406@oisinglynn.com>
Permalink:  ../448848B8.8010406@oisinglynn.com/
Also on:    postgresql.org/message-id/448848B8.8010406@oisinglynn.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: me@oisinglynn.com, postgresql@dafunks.com
  Subject: Re: Concat two fields into one at runtime
  In-Reply-To: <448848B8.8010406@oisinglynn.com>

* 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