Subject multiple group by
Author Michal Žeravík
I had similar problem as I found in forum:

SELECT
c.categoryid,
c.name,
COUNT(x.categoryid)
FROM
categories c
LEFT JOIN
books_to_categories x
ON c.categoryid = x.categoryid
GROUP BY c.categoryid

Try the group by clause:
GROUP BY c.categoryid, c.name
If you combine in the select an aggregate function (count, sum, max)
together with 'normal' colums (id, name, etc.), all the normal columns
have to be in the group by clause.


Is it right? I really need all columns I want to list put to Group By
clause?

Michal


[Non-text portions of this message have been removed]