CASE
От | Rudi Starcevic |
---|---|
Тема | CASE |
Дата | |
Msg-id | 3E928853.7090801@oasis.net.au обсуждение исходный текст |
Ответы |
Re: CASE
|
Список | 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 по дате отправления: