日期:2014-05-17 浏览次数:20665 次
select field1,field2 from t_yourtable where createime between yourparam1 and yourparam2
------解决方案--------------------
tbor_create_time 为传入的字符串
--查询一天
select * from tbl_order where date(tbor_create_time) = curdate();
select * from tbl_order where to_days(tbor_create_time) = to_days(now());
--查询一个周
select * from tbl_order where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(tbor_create_time);
--查询一个月
select * from tbl_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(tbor_create_time);
--两个日期之间的数据
select * from tbl_order where tbor_create_time>'2012-01-20 00:00:00' and tbor_create_time<'2012-02-7 00:00:00';
推荐楼主看看 http://blog.sina.com.cn/s/blog_65b9fc310100lj0b.html