Is there a GROUP BY in the query that produces the results? If so, you can use WITH ROLLUP to generate the total, and it will be part of the result set.
You also could use COMPUTE; be aware, though, that this means two different result sets are generated: the detail set, and the total set.
SELECT ...
FROM ...
WHERE ...
COMPUTE SUM(Quantity), SUM(Amount), SUM(Total)
Main Topics
Browse All Topics





by: BriCrowePosted on 2008-03-10 at 11:42:15ID: 21088993
Typically this kind of functionality would be handled at the application level. As an alternative try...
SELECT ... --Existing Query
UNION
SELECT 'Grand Total', SUM(Quantity), SUM(Amount), SUM(Total)
FROM ...