Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MYSQL通过wordpress加入Group_Mysql_Wordpress - Fatal编程技术网

MYSQL通过wordpress加入Group

MYSQL通过wordpress加入Group,mysql,wordpress,Mysql,Wordpress,我在wordpress中有一个自定义的帖子类型,我想得到按自定义日期字段按月分组的帖子数量。我的输出应该是 Month CountofPost April 1 August 2 但是,上面代码的输出是 Month CountofPost April 1 August 1 August 1 邮政月数 四月一日 八月一日 八月一日 我做错了什么?将group by子句更改为group by monthname(met.meta\u值) Month CountofPost April 1

我在wordpress中有一个自定义的帖子类型,我想得到按自定义日期字段按月分组的帖子数量。我的输出应该是

Month CountofPost April 1 August 2 但是,上面代码的输出是

Month CountofPost April 1 August 1 August 1 邮政月数 四月一日 八月一日 八月一日
我做错了什么?

将group by子句更改为
group by monthname(met.meta\u值)

Month CountofPost April 1 August 1 August 1
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 monthname(met.meta_value)