Subject Re: [firebird-support] Firebird 1.0.3 select group by -> invalid column reference
Author Helen Borrie
At 04:39 AM 29/08/2003 +0000, you wrote:
>Hello,
>
>I am using Firebird 1.0.3. But when I issue the following SQL
>statement, I always get a invalid column reference error.
>
> SELECT * FROM MEMBERSHIP GROUP BY USERNAME;
>
>But the following run OK
>
> SELECT * FROM MEMBERSHIP ORDER BY USERNAME;
>
>I seems Firebird does not support the GROUP BY. Is it?

Yes, of course it supports GROUP BY. But it can't perform GROUP BY on an
invalid specification. You are getting the error because either
1) there is no column called USERNAME in the output set
or
2) there is a column called USERNAME but there are other columns in the
output set that cannot be aggregated under each distinct username.

It can be generally said that, if you use select * with GROUP BY then you
don't understand what GROUP BY is for. You need to define your objective
(the set you want to output) and set up a valid SELECT list accordingly.

You could try this link (gracias Arno!) for a little self-instruction:
http://www.w3schools.com/sql/sql_groupby.asp

heLen