Received: from sandtstudent.pyr.ec.gc.ca (fwvan1.pyr.ec.gc.ca [199.212.20.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e58H0YT46758 for ; Thu, 8 Jun 2000 13:00:34 -0400 (EDT) Received: from ec.gc.ca (IDENT:huangb@sandtstudent [131.235.150.249]) by sandtstudent.pyr.ec.gc.ca (8.9.3/8.9.3) with ESMTP id KAA15577 for ; Thu, 8 Jun 2000 10:01:05 -0700 Message-ID: <393FD150.3AC1717@ec.gc.ca> Date: Thu, 08 Jun 2000 10:01:04 -0700 From: Bernie Huang Organization: Environment Canada X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: PGSQL-SQL Subject: SQL 'Case When...' Content-Type: multipart/mixed; boundary="------------9A00E5452B7C5997189A671E" X-Archive-Number: 200006/93 This is a multi-part message in MIME format. --------------9A00E5452B7C5997189A671E Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit 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 --------------9A00E5452B7C5997189A671E Content-Type: text/x-vcard; charset=iso-8859-15; name="bernie.huang.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Bernie Huang Content-Disposition: attachment; filename="bernie.huang.vcf" begin:vcard n:Huang;Bernie tel;fax:(604)664-9195 tel;work:(604)664-9172 x-mozilla-html:TRUE org:Environment Canada;Standards and Technology Services adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada version:2.1 email;internet:bernie.huang@ec.gc.ca title:Programmer x-mozilla-cpt:;0 fn:Bernie Huang end:vcard --------------9A00E5452B7C5997189A671E--