List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 24 1999 8:04pm
Subject:Re: date problem
View as plain text  
At 6:31 AM -0700 6/24/99, Dan Parisien wrote:
>I couldn't find a good enough example in the documentation,
>I have a table with created_on date fields, I want to query created on fields
>created in the last 5 days or something,
>do I do curdate()+5 ??
>Im not sure how,
>thanks,
>Dan P


Something like that, though you might want curdate()-5 instead. :-)

mysql> create table t (date date);
mysql> insert t values("1999-6-23"),(19990622),(19990620),(19990618);
mysql> select * from t;
+------------+
| date       |
+------------+
| 1999-06-23 |
| 1999-06-22 |
| 1999-06-20 |
| 1999-06-18 |
+------------+
mysql> select * from t where date < curdate()-5;
+------------+
| date       |
+------------+
| 1999-06-18 |
+------------+

-- 
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
date problemDan Parisien24 Jun
  • Re: date problemPaul DuBois25 Jun
    • Re: date problemMichael Widenius28 Jun