织梦查询近7天,近30天发布文章的数量

2017-04-13 14:27:27 dedecms

业务需求,需要查询

织梦

某栏目近期发布文章的数量,写了两条sql语句,已经测试过分享给大家

织梦某栏目近7天发布文章的数量

Select count(id) as total From dede_archives where  DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= FROM_UNIXTIME(pubdate,'%Y-%m-%d') and typeid=171

织梦某栏目近30天发布文章的数量

Select count(id) as total From dede_archives where  DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= FROM_UNIXTIME(pubdate,'%Y-%m-%d') and typeid=171