X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DA437D1B503 for ; Tue, 9 Sep 2003 07:18:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 35837-10 for ; Tue, 9 Sep 2003 04:18:38 -0300 (ADT) Received: from p15140235.pureserver.info (sql-info.de [217.160.166.164]) by svr1.postgresql.org (Postfix) with ESMTP id C2C80D1B502 for ; Tue, 9 Sep 2003 04:18:36 -0300 (ADT) Received: from iwate.sql-info.de (pD951728F.dip.t-dialin.net [217.81.114.143]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by p15140235.pureserver.info (Postfix) with ESMTP id B9AA31C58; Tue, 9 Sep 2003 09:18:36 +0200 (CEST) From: Ian Barwick To: "Richard Sydney-Smith" , Subject: Re: Conversion from Sybase ASA Date: Tue, 9 Sep 2003 09:17:26 +0200 User-Agent: KMail/1.5.1 References: <001001c376a0$ee48a8d0$f06832d2@athlon2000> In-Reply-To: <001001c376a0$ee48a8d0$f06832d2@athlon2000> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309090917.26320.barwick@gmx.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/59 X-Sequence-Number: 15037 On Tuesday 09 September 2003 09:06, Richard Sydney-Smith wrote: > In sybase I can use the following syntax: > > select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > > '1900/9/30' then 'U' else 'P' endif) as pres from ftrans > > this returns two columns: src = 'T' and pres which has either the value 'U' > or 'P' > > how would I express this in postgresql? "CASE": http://www.postgresql.org/docs/7.3/static/functions-conditional.html Ian Barwick barwick@gmx.net