PeterErhard
asked on
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)
select * from table
where DATE >= '2011-09-17' (todays date)
AND DATE <= '2011-09-24' (one week from now)
just use data type as date for date column then use simple query as mention .. It will work fine
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes but use datatype as date for date column field
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";
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";
ASKER
Thanks for your help guys, _agx_'s was what I was most looking for.