WordPressでデータを集計する際のクエリ。
1 2 3 |
select * from wp_posts as p where post_status = 'publish' and post_type = 'post' |
1 2 3 4 5 |
select date_format(post_date, '%Y-%m') as ym, count(1) as count from wp_posts as p where post_status = 'publish' and post_type = 'post' group by date_format(post_date, '%Y-%m') order by ym asc |
コメント