Re: case expression

From: Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: case expression
Date: 2008-09-24 22:22:16
Message-ID: 200809242322.16779.garry@schoolteachers.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 24 September 2008 21:03, Tom Lane wrote:
> Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk> writes:
> > Can anyone tell me why this will not work?
> >
> > select *,
> > CASE WHEN postcode ilike '%OO%' THEN ''
> > END
> > from addresses
> > ...
>
> Define "not work". What are you expecting it to do versus what
> really happens?
>
> Right offhand it looks like the CASE will return either an empty
> string or a NULL, which doesn't seem particularly useful ...
>
> regards, tom lane
It does work but returns a column called case. How can I return the case
column as 'postcode'?

Regards
garry

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Taras Kopets 2008-09-24 22:51:44 Re: problem with custom_variable_classes
Previous Message Raymond O'Donnell 2008-09-24 22:19:02 Re: case expression