Re: CASE

From: "Victor Yegorov" <viy(at)pirmabanka(dot)lv>
To: Rudi Starcevic <rudi(at)oasis(dot)net(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: CASE
Date: 2003-04-08 09:40:39
Message-ID: 20030408094039.GS1712@pirmabanka.lv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Rudi Starcevic <rudi(at)oasis(dot)net(dot)au> [08.04.2003 11:37]:
> CASE
> WHEN COALESCE( MAX(e.edate),'2003-01-01') >= now()::date THEN 'events'
> ELSE 'noevents'
> 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.

--

Victor Yegorov

In response to

  • CASE at 2003-04-08 08:29:07 from Rudi Starcevic

Responses

  • Re: CASE at 2003-04-08 10:57:59 from Rudi Starcevic
  • Re: CASE at 2003-04-08 12:06:15 from Greg Stark

Browse pgsql-sql by date

  From Date Subject
Next Message Yudha Setiawan 2003-04-08 09:52:49 Language SQL, But Need Return PlPgSql
Previous Message Rudi Starcevic 2003-04-08 08:29:07 CASE