List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 30 2002 1:02pm
Subject:Re: DATES and WHERE
View as plain text  
2002-09-29 = 1973

I suppose dte>1973.

Johnny Withers wrote:

>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
>johnny@stripped
>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 <mysql-thread118387@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
DATES and WHEREJohnny Withers29 Aug
  • RE: DATES and WHEREMary Stickney29 Aug
  • Re: DATES and WHEREGerald Clark30 Aug