List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 18 2000 12:31pm
Subject:Re: Date format bug (22 and 23)
View as plain text  
At 8:43 PM -0600 2000-01-17, harlan@stripped wrote:
>Hi,
>
>MySQL is supposed to allow a date to be specified with single-digit
>months and days if the numbers are less than ten, but does not:
>
>bug.sql:
>-----------------------------------------------------------------
>create table bug
>(
>	dt date
>);
>
>insert into bug (dt) values ('2000-1-1');
>insert into bug (dt) values ('2000-1-2');
>insert into bug (dt) values ('2000-1-3');
>
>select count(*) from bug where dt between '2000-1-01' and '2000-1-03';
>select count(*) from bug where dt between '2000-01-01' and '2000-01-03';
>-----------------------------------------------------------------
>
>output:
>-----------------------------------------------------------------
>count(*)
>0
>count(*)
>3
>-----------------------------------------------------------------


This is due to the implementation of BETWEEN.  Try using
WHERE dt >= mindate AND dt <= maxdate.

-- 
Paul DuBois, paul@stripped
Thread
Date format bug (22 and 23)harlan18 Jan
  • Re: Date format bug (22 and 23)Paul DuBois18 Jan
    • Re: Date format bug (22 and 23)Tim Bunce18 Jan
      • Re: Date format bug (22 and 23)Michael Widenius26 Jan