Re: how to return field based on field= NULL or not

Поиск
Список
Период
Сортировка
От Wojtek
Тема Re: how to return field based on field= NULL or not
Дата
Msg-id 4A920F4B.7080607@twine.pl
обсуждение исходный текст
Ответ на how to return field based on field= NULL or not  (Juan Backson <juanbackson@gmail.com>)
Ответы Re: how to return field based on field= NULL or not
Список pgsql-general
Hi,

I assume  one field will always be NULL and one will always has data in it.

select coalesce(fieldA, fieldB) from table

Regards,
foo

Juan Backson wrote:
> 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Adam Rich
Дата:
Сообщение: Re: how to return field based on field= NULL or not
Следующее
От: Kushal Vaghani
Дата:
Сообщение: Install from Source On Windows - University of Sydney Research