| From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
|---|---|
| To: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: case expression |
| Date: | 2008-09-24 22:19:02 |
| Message-ID: | 48DABCD6.9020806@iol.ie |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 24/09/2008 23:22, Garry Saddington wrote:
>> Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk> writes:
>>> 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'?
...case when postcode ilike '%OO%' then '' end as postcode, ...
BTW, should you have an "else" clause in there? - What happens when the
comparison fails?
Ray.
------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Garry Saddington | 2008-09-24 22:22:16 | Re: case expression |
| Previous Message | Richard Broersma | 2008-09-24 22:10:20 | Re: case expression |