![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
SELECT DATE_FORMAT( FROM_UNIXTIME( t.`created_at`, '%Y-%m-%d %H:%i:%S' ), '%Y-%m' ) MONTH, count(t.course_id) MINUTE FROM course t WHERE DATE_FORMAT( FROM_UNIXTIME( `created_at`, '%Y-%m-%d %H:%i:%S' ), '%Y-%m' ) > DATE_FORMAT( date_sub(curdate(), INTERVAL 12 MONTH), '%Y-%m' ) AND `status` >= 1 GROUP BY MONTH