mysql 时间查询

查询上周

select * from wr_workorder_info where recorddt>=date_add(date_format(now(),'%Y-%m-%d'),interval -(7 + weekday(now())) day)
and recorddt< date_add(now(),interval -(0 + weekday(now())) day);

查询前两周

select * from wr_workorder_info where recorddt>=date_add(date_format(now(),'%Y-%m-%d'),interval -(14 + weekday(now())) day)
and recorddt< date_add(now(),interval -(0 + weekday(now())) day);

posted on 2013-06-27 10:51  静欲动  阅读(127)  评论(0编辑  收藏  举报

导航