[thelist] SQL select by date

Joshua Olson joshua at waetech.com
Thu Apr 18 16:40:01 CDT 2002


----- Original Message -----
From: "matthew garrett" <matthew.garrett at snet.net>
Sent: Thursday, April 18, 2002 4:33 PM
Subject: [thelist] SQL select by date


>             SELECT everything
>             FROM events
>             WHERE edate_start <= form.thedate
>                 AND edate_end >= form.thedate

I agree with others that setting the start date and end date equal will be
the easiest way.  I'd warn you, however, that some db's store time with the
dates.  Queries such as the one above become problematic if you are
considering the time the event starts.  The form.thedate is "4/1/2002" then
that will usually mean 12 midnight, april 1, 2002 to most databases.  Events
that start and end end later in the day might be excluded from the above
query.  It really all depends on whether or not you store times with the
event dates.

Just a potential gotcha to look out for.

Have a wonderful day.

-joshua





More information about the thelist mailing list