Subject Re: Help with query - Invalid expression in the select list
Author russx2
> Just include all of the grouping columns in the column list:
> 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, c.name
>
> ./heLen

Thanks Helen. Simple when you know how, huh? :-) Could you please
explain why the extra group-bys are necessary? They seem somewhat
redundant in this example.

I'd assume if I was selecting a further 10 columns, I would also
require the 10 additions to the group-by clause? Not quite sure I
understand this one.

Thanks,
Russ