Subject RE: [firebird-support] SUM, group by
Author Planles
> try
> > select Field1,Field2, Field3,
> > SUM(Field4) as SField4,
> > SUM(Field5) as SField5,
> > SUM(Field6) as SField6
> > from TABLE
> > group by Field1, field2, field3

Thanks for all answers.
Is this the fact, that there should be all selected fields, which are not
SUM, included in group by ?

I'm asking that, because in my example Field2 and Field3 are the same for
each different Field1.
Maybe my last sentence is not well written, so this example should tell
more:

Field1 Field2 Field3 Field4 ...
el1 a1 b1 2
el2 a2 b2 5
el3 a3 b3 3
el2 a2 b2 1
el3 a3 b3 8
el1 a1 b1 1

And the result:
Field1 Field2 Field3 Field4 ...
el1 a1 b1 3
el2 a2 b2 6
el3 a3 b3 11

Each time Field1 is "el1", Field2 is "a1" and Field3 is "b1".

Because of that I'm comfused, why it should be all 3 fields included in
group by.
Is that just, because "group by" works this way?

Thanks in advance for the explanation.

Regards,
Primoz