mysql 统计当前年度、月度、周 数据

-- select * from news_xyh_praise WHERE year(create_time) = year(curdate( ))
-- select * from news_xyh_praise WHERE quarter(create_time)= quarter( curdate( )) and  year(create_time) = year(curdate( ))
-- select * from news_xyh_praise WHERE month(create_time)=month(curdate( )) and year(create_time) = year(curdate())

-- select * from news_xyh_praise where month(create_time) = month(curdate()) and week(create_time) = week(curdate())

 

你可能感兴趣的:(数据库)