Subject | RE: [firebird-support] subtotals |
---|---|
Author | Bob Murdoch |
Post date | 2005-04-04T19:59:27Z |
Petr,
select
cast(acolumn as varchar(10)), sum(bcolumn)
from
atable
group by
acolumn
union all
select
cast('TOTAL' as varchar(10)), sum(bcolumn)
from
atable
or, you can write a stored procedure that will sum the values of the
details as they are output, and sends a final row with the total.
hth,
Bob M..
> -----Original Message-----You can try using a UNION query:
> From: mcbootchek [mailto:petr@...]
> Sent: Monday, April 04, 2005 2:09 PM
>
> is there any possibility to get subtotals and total using the
> SELECT command?
select
cast(acolumn as varchar(10)), sum(bcolumn)
from
atable
group by
acolumn
union all
select
cast('TOTAL' as varchar(10)), sum(bcolumn)
from
atable
or, you can write a stored procedure that will sum the values of the
details as they are output, and sends a final row with the total.
hth,
Bob M..