Board index » delphi » Can my query count sum?

Can my query count sum?

Hi!
I find it interesting is it possible in a query like that

SELECT Sum(Price), Id_field
WHERE  My conditions
GROUP BY ...

to count not only the sum of Sum(Price), but SUM(Sum(Price)) I mean the
total Sum for the aggregate field...
And I do think that it might be visual by my DBGrid, so compute by doesn't
seem to be usefull(?).
(D4 and SQL 7)
Thanks, Ivan

 

Re:Can my query count sum?


You need two queries. As you have grouped this one, it will always return a
sum for each of the grouping conditions. To get a sum of all, create another
sql without the group by.

--
Adroit Software Ltd
------------------------------
Remove the nospam. to mail me direct

Quote
Ivan wrote in message <7n6qvl$ls...@forums.borland.com>...
>Hi!
>I find it interesting is it possible in a query like that

>SELECT Sum(Price), Id_field
>WHERE  My conditions
>GROUP BY ...

>to count not only the sum of Sum(Price), but SUM(Sum(Price)) I mean the
>total Sum for the aggregate field...
>And I do think that it might be visual by my DBGrid, so compute by doesn't
>seem to be usefull(?).
>(D4 and SQL 7)
>Thanks, Ivan

Re:Can my query count sum?


Thank Brian!
Frankly spaking I already have had two quiries and just thought if it would
be possible...
But thank you anyway.
Ivan

Brian Jones <bri...@nospam.adroit-software.co.uk> ???Y ?????
???Y??:7n73cj$m...@forums.borland.com...

Quote
> You need two queries. As you have grouped this one, it will always return
a
> sum for each of the grouping conditions. To get a sum of all, create
another
> sql without the group by.

> --
> Adroit Software Ltd
> ------------------------------
> Remove the nospam. to mail me direct
> Ivan wrote in message <7n6qvl$ls...@forums.borland.com>...
> >Hi!
> >I find it interesting is it possible in a query like that

> >SELECT Sum(Price), Id_field
> >WHERE  My conditions
> >GROUP BY ...

> >to count not only the sum of Sum(Price), but SUM(Sum(Price)) I mean the
> >total Sum for the aggregate field...
> >And I do think that it might be visual by my DBGrid, so compute by
doesn't
> >seem to be usefull(?).
> >(D4 and SQL 7)
> >Thanks, Ivan

Other Threads