Re: Concat two fields into one at runtime

From: Oisin Glynn <me(at)oisinglynn(dot)com>
To: George Handin <postgresql(at)dafunks(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Concat two fields into one at runtime
Date: 2006-06-08 15:56:40
Message-ID: 448848B8.8010406@oisinglynn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Philippe Lang 2006-06-08 16:00:42 pgxml & xpath_table
Previous Message Bricklen Anderson 2006-06-08 15:54:10 Re: Concat two fields into one at runtime