Date within mySQL query

Is there a way to within a query to use a date calculation to do the following rather than having to do it with php

select * from table
where DATE >=  '2011-09-17' (todays date)
AND DATE <=  '2011-09-24'  (one week from now)
PeterErhardAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
_agx_Connect With a Mentor Commented:
If I'm understanding correctly, you can use mySQL's date functions to calculate the dates.

SELECT *
FROM     table
WHERE  DATE >= curDate()
AND       DATE <=  DATE_ADD(curDate(), INTERVAL 7 DAY)
0
 
savsoftCommented:
just use data type as date for date column then use simple query as mention .. It will work fine
0
 
savsoftCommented:
yes but use datatype as date for date column field
0
 
Swadhin RaySenior Technical Engineer Commented:
Try this:

mysql> select * from table where date_column between  '2011-09-17'and  '2011-09-24';

mysql> Select * from tables where date > "2011-09-17' and CREATE_TIME < "2011-09-24";

0
 
PeterErhardAuthor Commented:
Thanks for your help guys, _agx_'s was what I was most looking for.
0
All Courses

From novice to tech pro — start learning today.