Home >Database >Mysql Tutorial >mysql查询一天,一周等隔日数据_MySQL

mysql查询一天,一周等隔日数据_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:39:021370browse

bitsCN.com


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)

--查询一个月

select * from tbl_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY)

 

--两个日期之间的数据

select * from tbl_order where tbor_create_time>'2012-01-20 00:00:00' and tbor_create_time

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn