Subject | Re: [firebird-support] Selecting First Record |
---|---|
Author | Mitchell Peek |
Post date | 2006-08-09T16:31:49Z |
smeadsnz wrote:
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.
>Hi,If that were allowed, it would give misleading results.
>
>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.
>
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.