On Aug 27, 2007, at 13:12 , Michael Glaesemann wrote:
select city, event, event_date, (
select count(event)
from events i
where i.city = o.city
and i.event_date < o.event_date
and event_date > current_date -- make sure they're future
events
This should be i.event_date > current_date to be explicit.
) as nearness_rank
from events o
where event_date > current_date -- make sure they're future events
having nearness_rank <= 1;
Michael Glaesemann
grzm seespotcode net
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly