how to return field based on field= NULL or not

From: Juan Backson <juanbackson(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: how to return field based on field= NULL or not
Date: 2009-08-24 03:36:05
Message-ID: 27c25bc40908232036k3e48f3d8j151010d54f7530ce@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

In my table, I have fieldA and fieldB. At any point in time, only one of
these fields can have data in it. The other is NULL.

Instead of "select fieldA, fieldB from table", I want it to return either
fieldA or fieldB depends on whether it is NULL or not.

The reason is because I want to use "select
array_to_string(array_accum(field A or field B) ,',') from table.

Is it possible to do it that way?

Thanks,
JB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Rich 2009-08-24 03:53:36 Re: how to return field based on field= NULL or not
Previous Message Alvaro Herrera 2009-08-24 02:24:57 Re: Getting listed on "Community Guide to PostgreSQL GUI Tools"