Subject | Re: multiple group by |
---|---|
Author | GrumpyRain |
Post date | 2004-11-23T03:05:42Z |
--- In firebird-support@yahoogroups.com, Michal ®eravík <michalz@o...>
wrote:
wrote:
> I had similar problem as I found in forum:That is correct
>
> 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]