thinkphp中怎么用group和count查询三篇文章各自的评论数

2025-02-27 14:27:42
推荐回答(1个)
回答1:

M("table_name")->field("count(*) as sum")->where(['article_id'=>['in',[23,445,66]]])->group("pinglun_id")->select();
希望能看懂,table_name 表名,article_id文章ID,pinglun_id评论内容ID,