织梦查询当前周,当前月发布文章的数量

2017-04-13 14:27:28 dedecms

织梦

查询某栏目这一周发布文章的数量

Select count(id) as total From dede_archives  where YEARWEEK(FROM_UNIXTIME(pubdate,'%Y-%m-%d')) = YEARWEEK(now()) and typeid = 171

织梦查询某栏目当前月发布文章的数量

Select count(id) as total From dede_archives where FROM_UNIXTIME(pubdate,'%Y-%m') = date_format(now(),'%Y-%m') and typeid =171

织梦查询某栏目今年发布文章的数量

Select count(id) as total From dede_archives where FROM_UNIXTIME(pubdate,'%Y') = date_format(now(),'%Y') and typeid =171

所有sql语句,我都测试过,分享给大家