mysql的日期查询,一周,一天,元月份,两个日期之间的数据

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);
–查询一个月
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’;

mysql的日期查询,一周,一天,元月份,两个日期之间的数据

相关文章:

你感兴趣的文章:

标签云: