开发者

MySQL GROUP BY Doesn't effect

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜