mysql查詢一天,一周等隔日數據
--查詢一天
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);
www.2cto.com
--查詢一個月
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';