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 e6OLFJh33783 for ; Mon, 24 Jul 2000 17:15:19 -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 OAA26935 for ; Mon, 24 Jul 2000 14:15:33 -0700 Message-ID: <397CB1F3.8B974506@ec.gc.ca> Date: Mon, 24 Jul 2000 14:15:31 -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@postgresql.org Subject: Re: Select by priority again References: Content-Type: multipart/mixed; boundary="------------68DBBE0DED1F5CA6EA83152F" X-Archive-Number: 200007/229 This is a multi-part message in MIME format. --------------68DBBE0DED1F5CA6EA83152F Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit "D'Arcy J.M. Cain" wrote: > [Note: PHP mailing list removed from Cc as this is strictly a > PostgreSQL question I think.] > > Thus spake Bernie Huang > > Sorry about this, but I don't quite get previous postings regarding > > select by prioriry. > > > > I have the same question with my sql. I want to be able to select > > cell_phone if there is one in the table; otherwise, I will select > > work_phone. > > > > table > > ------ > > id, name, address, cell_phone, work_phone,... > > > > and I tried using "case when...end" but nope, it's not gonna work. Help > > is needed. Thanks. > > Exactly what was the SQL statement and which version of PostgreSQL? I > do this in a view and it works. > > SELECT CASE WHEN login IS NULL THEN uid::text ELSE login END AS login > FROM account; > > -- > D'Arcy J.M. Cain | Democracy is three wolves > http://www.druid.net/darcy/ | and a sheep voting on > +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. hi, thanks for the help. I will avoid to CC to the wrong list. - Bernie --------------68DBBE0DED1F5CA6EA83152F 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 --------------68DBBE0DED1F5CA6EA83152F--