CASE - Mailing list pgsql-sql

From Rudi Starcevic
Subject CASE
Date
Msg-id 3E928853.7090801@oasis.net.au
Whole thread Raw
Responses Re: CASE
List pgsql-sql
Hi,

I'm trying to find the maximum date then compare that date to see if I 
have any current events to show.
Here is an SQL snippet ( the e.edate field is of type 'date' )

CASE       WHEN COALESCE( MAX(e.edate),'2003-01-01') >= now()::date THEN 'events'   ELSE 'noevents'            
END as myevents,

It works fine for those events who do have dates greater or equal to now and
also for those events who have a NULL value.

However there is one event which is in the past '2003-04-01' which is 
still coming up as 'events' instead of 'noevents'.
I think there may be something wrong with my CASE SQL clause.

I can't see any problem right now can anyone here see one ?

Thank you kindly
Regards
Rudi.



pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Creating a foreign key on the Union of two tables
Next
From: "Victor Yegorov"
Date:
Subject: Re: CASE