Subject Re: [firebird-support] multiple group by
Author Daniel Rail
Hi,

At November 22, 2004, 12:53, Michal Žeravík wrote:


> 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?

Yes that is correct. And, this is part of the SQL standard.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)