Re: case statement to cath nulls on joined tables

Поиск
Список
Период
Сортировка
От Matheus de Oliveira
Тема Re: case statement to cath nulls on joined tables
Дата
Msg-id CAJghg4+Uk2+Dh6smvG2n8-xKGCLGT7Ltx_c-cXP3_Gbm6O0RXQ@mail.gmail.com
обсуждение исходный текст
Ответ на case statement to cath nulls on joined tables  (John Morgan <jdmorgan@unca.edu>)
Ответы Re: case statement to cath nulls on joined tables  (Matheus de Oliveira <matioli.matheus@gmail.com>)
Список pgsql-admin
Try that:

SELECT address, CASE WHEN value_of_interest IS NULL THEN 'more friendly message' ELSE value_of_interest END value_of_interest
From poly_table left outer join data_table one poly_table.common_id = data_table.common_id


--
Matheus de Oliveira




On Fri, Feb 3, 2012 at 10:45 AM, John Morgan <jdmorgan@unca.edu> wrote:
Hello,

I am doing a left outer join between a polygon table and a data table.
 Everything
returns fine from this join as expected.  However, there are cases where
there isn?t data for a given polygon and this return as the expected null
in the result set.  I would like to utilize something like a case statement
to catch the nulls and return a ?more friendly? message.  I have tried
unsuccessfully to use the following logic:

*Select case value_of_interest null then ?more friendly message? else
value_of_interest end*

*From poly_table left outer join data_table one poly_table.common_id =
data_table.common_id*

If someone could let me know where I am going wrong it would be greatly
appreciated.

Cheers,

Derek

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

Предыдущее
От: John Morgan
Дата:
Сообщение: case statement to cath nulls on joined tables
Следующее
От: Matheus de Oliveira
Дата:
Сообщение: Re: case statement to cath nulls on joined tables