Matthew
This should do it:
CREATE CURSOR 'curinfo' ;
( ;
id i ,;
name c(20),;
Amount n(10,2),;
tax n(9,2);
)
INSERT INTO 'curinfo' values(4,'Matt',3,.1)
INSERT INTO 'curinfo' values(2,'Joe',2,.1)
INSERT INTO 'curinfo' values(5,'Tim',6,.1)
SELECT * ;
FROM curinfo ;
UNION ;
select 999 as id, 'Total' as name, ;
SUM(curinfo.amount) as amount, ;
SUM(curinfo.tax) as tax ;
FROM curinfo ;
into cursor curtemp
Andrew Stirling
01250 874580
http://www.calcpay.co.uk
HMRC Accredited UK payroll program
Matthew Jarvis wrote:
> Has anyone ever come up with a way to have a SQL statement add a line at
> the end that consists of totals of all the previous lines? Is something
> like that even possible?
>
> For example, if this would be the result of my SQL code:
>
> ID Name Amount Tax
>
> 4 Matt 3 .10
> 2 Joe 2 .10
> 5 Tim 6 .10
>
>
> It would be convenient to have it come out like this:
>
> ID Name Amount Tax
>
> 4 Matt 3 .10
> 2 Joe 2 .10
> 5 Tim 6 .10
> Total 11 .30
>
>
> Or something like that....
>
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.