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;
精彩评论