Date comparison issue
- From: "javelin" <google.1.jvmail@xxxxxxxxxxxxxxx>
- Date: 30 Jan 2007 09:21:11 -0800
I have a table with dates stored in a text field (designed before my
time, I'm just stuck with the headaches). When I run the following
query:
SELECT DATE_FORMAT(datefield,'%m/%d/%Y') FROM computers where
datefield>'1/1/2000' and DATE_FORMAT(datefield,'%m/%d/%Y') <
'12/1/2006' group by datefield;
I get 22 records. However, when I use the following query (which I
think is better), I lose some of the records that match the criteria,
as when I run the first one:
SELECT DATE_FORMAT(datefield,'%m/%d/%Y') FROM computers where
DATE_FORMAT(datefield,'%m/%d/%Y') >'1/1/2000' and
DATE_FORMAT(datefield,'%m/%d/%Y') < '12/1/2006' group by datefield;
Any clues as to why? Any way to convert the date for accurate
comparisons????
Thanks.
.
- Follow-Ups:
- Re: Date comparison issue
- From: Steve
- Re: Date comparison issue
- Prev by Date: Re: Regular Expression Query
- Next by Date: Re: Date comparison issue
- Previous by thread: for logan: pleasant newsgroup access - uk - (1/1)
- Next by thread: Re: Date comparison issue
- Index(es):
Relevant Pages
|
|