create_time时间格式SELECT DATE_FORMAT(create_time,'%Y%m%d') days,COUNT(id) COUNT FROM role GROUP BY days;create_time时间戳格式SELECT FROM_UNIXTIME(create_time,'%Y%m%d') days,COUNT(id) COUNT FROM role GROUP BY days;举例:<!--查询主管最近30天注册用户数 -->SELECT DATE_FORMAT(a.create_time, '%Y%m%d') AS days, COUNT(*) AS userCountFROM sssss aWHERE a.dept_id = 1AND a.create_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)AND a.recommender_user_id IN (SELECT DISTINCT b.recommender_user_idFROM sssssss bJOIN ssssss c ON b.recommender_user_id = c.user_idWHERE c.distri_user_id = #{userId})GROUP BY days;
300字范文,内容丰富有趣,生活中的好帮手!