开发者

MySQL GROUP BY Doesn't effect

开发者 https://www.devze.com 2023-02-02 04:37 出处:网络
My query is like the following: SELECT count(*) AS total FROM posts GROUP BY category The tota开发者_开发百科l returned is the total of all posts, Can some one please point me where is the issue in

My query is like the following:

SELECT count(*) AS total FROM posts GROUP BY category

The tota开发者_开发百科l returned is the total of all posts, Can some one please point me where is the issue in my syntax?

Thanks in advance.


I think the correct would be:

SELECT category, COUNT(*) AS total FROM posts GROUP BY category;
0

精彩评论

暂无评论...
验证码 换一张
取 消