Subject Re: [firebird-support] Help with query - Invalid expression in the select list
Author Miroslav Penchev
Hi,

On Mon, 06 Sep 2004 10:02:17 +1000, Helen Borrie <helebor@...>
wrote:

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

Or this one:

SELECT
c.categoryid,
MAX(c.name) AS C_NAME, /*I will not use 'name' as field name - it is
quite dangerous*/
COUNT(x.categoryid)
FROM
categories c
LEFT JOIN books_to_categories x
ON c.categoryid = x.categoryid
GROUP BY c.categoryid

I am not sure which version of SELECT is more fast.

--
Miroslav Penchev