SQL 'Case When...'

Поиск
Список
Период
Сортировка
От Bernie Huang
Тема SQL 'Case When...'
Дата
Msg-id 393FD150.3AC1717@ec.gc.ca
обсуждение исходный текст
Список pgsql-sql
Hi,

Don't know if it's possible, but how do I make the following SQL
statments right?

table
-------
name  int4
attribute text[]


select attribute[1]
from table
case when attribute[1]='yes'
     then select attribute[2] from table
     else select attribute[3] from table;

Basically, I want to compare attr[1], if true then select some fields
from table; if false then select others.

Thank you.



- Bernie

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ORDER BY in definition of views
Следующее
От: Michael J Schout
Дата:
Сообщение: trigger/refint question..