List:General Discussion« Previous MessageNext Message »
From:Keith C. Ivey Date:July 1 2003 5:56pm
Subject:Re: Date query optimization
View as plain text  
On 1 Jul 2003 at 10:28, Karl J. Stubsjoen wrote:

> > The normal way to do a search for a range of dates would be
> >
> >    ... WHERE a.submitdate BETWEEN '2003-07-01' AND '2003-07-14';
> >
> > Is that what you're looking for?
> 
> submitdate happens to be a DATETIME field.
> Your suggested query doesn't pull any results.

If it's a DATETIME field, you'll want something like 

   ... WHERE a.submitdate BETWEEN '2003-07-01 00:00:00'
       AND '2003-07-14 23:59:59';

or

   ... WHERE a.submitdate >= '2003-07-01 00:00:00'
       AND a.submitdate < '2003-07-15 00:00:00';

-- 
Keith C. Ivey <keith@stripped>
Tobacco Documents Online
http://tobaccodocuments.org

Thread
Date query optimizationKarl J. Stubsjoen1 Jul
  • Re: Date query optimizationKeith C. Ivey1 Jul
    • Re: Date query optimizationKarl J. Stubsjoen1 Jul
      • Re: Date query optimizationKeith C. Ivey1 Jul
  • RE: Date query optimizationRick Robinson2 Jul