【发布时间】:2020-12-08 13:15:18
【问题描述】:
我在 wordpress 中有一个自定义帖子类型,我想在其中获取按自定义日期字段按月分组的帖子数。我的输出应该是
邮递月数 4月1日 8 月 2 日到目前为止我的 SQL 代码是
SELECT monthname(met.meta_value), count(pst.id) AS NumberOfPosts
from wp_postmeta met
inner join wp_posts pst
on met.post_id = pst.ID
where pst.post_type = 'custom_post_type'
and met.meta_key = 'start_date'
and pst.post_status = 'publish'
group by meta_value
但是,上面代码的输出是
邮递月数 4月1日 8 月 1 日 8 月 1 日我做错了什么?
【问题讨论】: