X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CD1EB4758E6 for ; Tue, 8 Apr 2003 05:40:22 -0400 (EDT) Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id AD0EE474E42 for ; Tue, 8 Apr 2003 05:40:20 -0400 (EDT) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.12.9/8.12.9) with SMTP id h389eLx0022357 for ; Tue, 8 Apr 2003 12:40:21 +0300 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Tue, 08 Apr 2003 12:40:20 +0300 (EET DST) Received: from pc311x1.pirmabanka.lv (localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.6/8.11.6) with SMTP id h389eKa08751 for ; Tue, 8 Apr 2003 12:40:20 +0300 Received: (qmail 12621 invoked by uid 100); 8 Apr 2003 09:40:39 -0000 Date: Tue, 8 Apr 2003 12:40:39 +0300 From: "Victor Yegorov" To: Rudi Starcevic Cc: pgsql-sql@postgresql.org Subject: Re: CASE Message-ID: <20030408094039.GS1712@pirmabanka.lv> Mail-Followup-To: Rudi Starcevic , pgsql-sql@postgresql.org References: <3E928853.7090801@oasis.net.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PEkEgRdBLZYkpbX2" Content-Disposition: inline In-Reply-To: <3E928853.7090801@oasis.net.au> User-Agent: Mutt/1.4.1i X-Spam-Status: No, hits=-37.8 required=5.0 tests=BAYES_10,IN_REP_TO,PGP_SIGNATURE_2,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/105 X-Sequence-Number: 12806 --PEkEgRdBLZYkpbX2 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Rudi Starcevic [08.04.2003 11:37]: > CASE=20=20=20=20 > WHEN COALESCE( MAX(e.edate),'2003-01-01') >=3D now()::date THEN 'event= s' > ELSE 'noevents'=20=20=20=20=20=20=20=20=20=20=20=20 > END as myevents, I'm not sure completely, but first thing i saw in your query, is: ...COALESCE( MAX(e.edate),'2003-01-01')... MAX(e.edate): will return date type (just a guess) '2003-01-01': will return char type (or varchar, doesn't matter). Try to cast string into date. --=20 Victor Yegorov --PEkEgRdBLZYkpbX2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+kpkX2RKGLEykUDYRAvNAAJ0TaMczF223WXQBKjKbzLNyFCquEACghJD1 9+aqg1nJRKhbSVP6jbs9gMg= =h0oL -----END PGP SIGNATURE----- --PEkEgRdBLZYkpbX2--