From: | "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com> |
---|---|
To: | "Garry Saddington" <garry(at)schoolteachers(dot)co(dot)uk> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Postgres General List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: case expression |
Date: | 2008-09-24 22:10:20 |
Message-ID: | 396486430809241510k4cbfc580gfe325909fa095cf1@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Sep 24, 2008 at 3:22 PM, Garry Saddington
<garry(at)schoolteachers(dot)co(dot)uk> wrote:
>> > select *,
>> > CASE WHEN postcode ilike '%OO%' THEN ''
>> > END
>> > from addresses
> It does work but returns a column called case. How can I return the case
> column as 'postcode'?
You have to give an Alias to this column name
CASE WHEN postcode ilike '%OO%' THEN ''
END AS postcode
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2008-09-24 22:19:02 | Re: case expression |
Previous Message | hubert depesz lubaczewski | 2008-09-24 21:38:25 | Re: problem with custom_variable_classes |