Re: amateur nite out

From: George Young <gry(at)ll(dot)mit(dot)edu>
To: "D(dot) Duccini" <duccini(at)backpack(dot)com>, Pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: amateur nite out
Date: 2001-01-03 14:29:42
Message-ID: 01010309453700.22945@pen
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, 02 Jan 2001, D. Duccini wrote:
> how do you select multiple columns but return them as a single column?
>
> ie, select lastname+', '+firstname as fullname from authors;
>
> of course it chokes on the + op

This needs to be double vertical bars, not plus signs:

select lastname || ', ' || firstname as fullname from authors;

In psql, the "\do" command (list operators), shows:

op |left_arg |right_arg |result |description
---+----------+----------+---------+-----------------------------------------
...
|| |text |text |text |concatenate

--
George Young, Rm. L-204 gry(at)ll(dot)mit(dot)edu
MIT Lincoln Laboratory
244 Wood St.
Lexington, Massachusetts 02420-9108 (781) 981-2756

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message D. Duccini 2001-01-03 14:48:44 Re: amateur nite out
Previous Message Poul L. Christiansen 2001-01-03 14:25:33 Re: ColdFusion sez this is valid SQL