Subject Re: [firebird-support] Re: union all and group by
Author Maurizio P.
________________________________
Da: Adam <s3057043@...>
A: firebird-support@yahoogroups.com
Inviato: Sabato 14 febbraio 2009, 2:33:09
Oggetto: [firebird-support] Re: union all and group by


ok , so i try to explain better :
i have two tables

tablea

cola1 cola2

for1 30
for2 15
for3 60
for2 5



tableb

colb1 colb2

for3 2
for2 1
for1 10
for2 5

result should be :

col1 total1 total2

for1 30 10
for2 20 6
for3 60 5

where total1 is the sum of cola2 and total2 is the sum of colb2
thanks
Maurizio


> it does not function .
> what i want to do is to have the select grouped by the first column ,
> globally .
>
>
> i just hope i have been clear .

"Does not function" is not a particularly useful error report. Next
time explain whether you received an error message (and provide it) or
whether the results returned were otherwise incorrect.

Looking at your SQL, I am guessing that you got an error message
because it is invalid. EVERY term in your select that is not an
aggregate must appear in the group by. In the first part of the query,
field 3 is missing from the group by. In the second part of the query,
field 2 is missing from the group by.

Adam





Passa a Yahoo! Mail.

La webmail che ti offre GRATIS spazio illimitato,
antispam e messenger integrato.
http://it.mail.yahoo.com/%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0%c2%a0

[Non-text portions of this message have been removed]