List:General Discussion« Previous MessageNext Message »
From:Dirk Bremer \(NISC\) Date:September 27 2004 7:47pm
Subject:Re: Date Range
View as plain text  
----- Original Message ----- 
From: <SGreen@stripped>
To: "Dirk Bremer (NISC)" <dirk.bremer@stripped>
Cc: <mysql@stripped>
Sent: Monday, September 27, 2004 14:30
Subject: Re: Date Range


> I think you are very close but you are missing the LAST day of each month.
> I think you need to change your WHERE to read
>
> WHERE queue_time >= @Start AND queue_time < @BegOfMonth
>
> Reasoning: If @BegOfMonth is '2004-09-01' then @End will be '2004-08-31'.
> If queue_time is a datetime value somewhen during the day of 8/31 (like
> '2004-08-31 13:15:46') then you miss it with "< @End". Because of the time
> component, you still miss that event if you change the comparator to "<=".
> You need to compare to < the next date (@BegOfMonth).
>
> '2004-08-31 13:15:46' < '2004-08-31'  is false
> '2004-08-31 13:15:46' <= '2004-08-31'  is false
> '2004-08-31 13:15:46' < '2004-09-01'  is true
>
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine

Shawn,

You are correct. It also eliminates any purpose for the @End variable, which
is fine.
I just tested it and the results were correct. Thanks a lot. It's still
Monday!

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471

dirk.bremer@stripped
www.nisc.cc

Thread
Date RangeDirk Bremer \(NISC\)27 Sep
  • Re: Date RangeSGreen27 Sep
    • Re: Date RangeDirk Bremer \(NISC\)27 Sep
      • Re: Date RangePaul DuBois27 Sep
        • Re: Date RangeSGreen27 Sep
          • Re: Date RangeDirk Bremer \(NISC\)27 Sep
    • Re: Date RangeDirk Bremer \(NISC\)27 Sep
      • Re: Date RangeSGreen27 Sep
        • Re: Date RangeDirk Bremer \(NISC\)27 Sep
Re: Date RangePaul DuBois27 Sep