Re: how to return field based on field= NULL or not - Mailing list pgsql-general

From Sam Mason
Subject Re: how to return field based on field= NULL or not
Date
Msg-id 20090824112602.GI5407@samason.me.uk
Whole thread Raw
In response to Re: how to return field based on field= NULL or not  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general
On Mon, Aug 24, 2009 at 12:54:31PM +0200, Alban Hertroys wrote:
>     CASE
>     WHEN fieldA IS NOT NULL THEN fieldA
>     WHEN fieldB IS NOT NULL THEN fieldB
>     WHEN fieldC IS NOT NULL THEN fieldC
>     ELSE fieldD
>     END

BTW, the above expression is identical to:

  COALESCE(fieldA,fieldB,fieldC,fieldD)

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: how to return field based on field= NULL or not
Next
From: Greg Stark
Date:
Subject: Re: Multiple table entries?