Received: from druid.net (root@druid.net [216.126.72.98]) by hub.org (8.10.1/8.10.1) with ESMTP id e6OJKph74471 for ; Mon, 24 Jul 2000 15:20:51 -0400 (EDT) Received: from localhost (1466 bytes) by druid.net via sendmail with P:stdio/R:bind_hosts/T:inet_zone_bind_smtp (sender: ) (ident using unix) id for ; Mon, 24 Jul 2000 15:20:46 -0400 (EDT) (Smail-3.2.0.109 1999-Oct-27 #3 built 2000-Jun-28) Message-Id: From: darcy@druid.net (D'Arcy J.M. Cain) Subject: Re: Select by priority again In-Reply-To: <397C88F1.29395142@ec.gc.ca> "from Bernie Huang at Jul 24, 2000 11:20:33 am" To: Bernie Huang Date: Mon, 24 Jul 2000 15:20:46 -0400 (EDT) CC: pgsql-sql@postgresql.org Reply-To: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200007/228 [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.