Subject Re: [firebird-support] Selecting First Record
Author Mitchell Peek
smeadsnz wrote:

>Hi,
>
>I am having a problem with the firebird sql in that there seems to be
>no way to group records by only one non-aggregate field.
>

If that were allowed, it would give misleading results.

For instance...

Select sum(c1), c2, c3
from sometable
group by 2, 3

might give a result of

Sum c2 c3
---------------
10 1 1
20 1 2
30 1 3
40 2 4
50 2 5


I expect you want something like this as a result set...
Sum c2 c3
---------------
60 1 ?
90 2 ?

but if you grouped by only c2, what value would expect returned for c3
for the two rows returned?

Any value returned would be misleading.