Re: coalesce function

From: Leif Biberg Kristensen <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: coalesce function
Date: 2013-06-20 16:28:37
Message-ID: 5335073.HxcfRAuDfV@balapapa
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Torsdag 20. juni 2013 21.45.02 skrev itishree sukla:
> Hi All,
>
> I am using coalesce(firstname,lastname), to get the result if first name is
> 'NULL' it will give me lastname or either way. I am having data like
> instead of NULL, blank null ( i mean something like '' ) for which
> coalesce is not working, is there any workaround or other function
> available in postgresql, please do let me know.

CASE WHEN firstname NOT IN (NULL, '') THEN firstname ELSE lastname END;

regards, Leif

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2013-06-20 17:36:56 Re: Tow kinds of different result while using create index concurrently
Previous Message Serge Fonville 2013-06-20 16:26:18 Re: coalesce function