Short answer  YES you have to have them

why because  2002-08-29 = 1965

-----Original Message-----
From: Johnny Withers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 1:30 PM
To: [EMAIL PROTECTED]
Subject: DATES and WHERE


I'm a bit confused here.. dates are not my strong point..
I have a table with a date column in it (DATE datatype)

a few values:
mysql> select dte from images\G
*************************** 1. row ***************************
dte: 2002-08-29
*************************** 2. row ***************************
dte: 2001-08-29
*************************** 3. row ***************************
dte: 2002-08-29
*************************** 4. row ***************************
dte: 2002-06-29
*************************** 5. row ***************************
dte: 2002-08-29
*************************** 6. row ***************************
dte: 2002-10-29
*************************** 7. row ***************************
dte: 1999-08-29
7 rows in set (0.00 sec)


When I impose a where condition on the date column (without using
single quotes around my target date, I still get all records):

mysql> select dte from images where dte>2002-09-20\G
*************************** 1. row ***************************
dte: 2002-08-29
*************************** 2. row ***************************
dte: 2001-08-29
*************************** 3. row ***************************
dte: 2002-08-29
*************************** 4. row ***************************
dte: 2002-06-29
*************************** 5. row ***************************
dte: 2002-08-29
*************************** 6. row ***************************
dte: 2002-10-29
*************************** 7. row ***************************
dte: 1999-08-29
7 rows in set (0.00 sec)


with quotes:

mysql> select dte from images where dte>'2002-09-20'\G
*************************** 1. row ***************************
dte: 2002-10-29
1 row in set (0.00 sec)



Is this correct? Should I have to use quotes around a date in a where
clause? Or do I have something wrong here?

mysql> select version()\G
*************************** 1. row ***************************
version(): 3.23.49-max-nt
1 row in set (0.00 sec)

---------------------
Johnny Withers
[EMAIL PROTECTED]
p. 601.853.0211
c. 601.209.4985


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to