| From: | Bernie Huang <bernie(dot)huang(at)ec(dot)gc(dot)ca> |
|---|---|
| To: | PGSQL-SQL <pgsql-sql(at)postgresql(dot)org> |
| Subject: | SQL 'Case When...' |
| Date: | 2000-06-08 17:01:04 |
| Message-ID: | 393FD150.3AC1717@ec.gc.ca |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| bernie.huang.vcf | text/x-vcard | 315 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael J Schout | 2000-06-08 17:49:10 | trigger/refint question.. |
| Previous Message | Niall Smart | 2000-06-08 15:41:48 | Re: ORDER BY in definition of views |