SQL 'Case When...' - Mailing list pgsql-sql

From Bernie Huang
Subject SQL 'Case When...'
Date
Msg-id 393FD150.3AC1717@ec.gc.ca
Whole thread Raw
List 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

Attachment

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: ORDER BY in definition of views
Next
From: Michael J Schout
Date:
Subject: trigger/refint question..