|
The answer is no.set.
SQL doesn't specifically support totals/subtotals of the data in a results
first place. For example,
SQL <> Reporting Tool
Instead, such functionality is left to whatever asked for the data in the
Query Manager. You create a QM query to get the data and a QM form toformat the results. One thing
you can do with the form is tell it where you want level breaks andtotals.
functionality (but note there
Having said all that, once and a while it's necessary to simulate such
is a performance price to pay).using UNION, each query must
You can do so with a UNION ALL of the two (or more) queries.
Select ID, Product, Level, sum(number) as total, '01' as rptLevel
From mytableGroup by ID, Product, Level
UNION ALL
Select ID, Product, ' ' as level, sum(number) as total, '02' as rptLevel
From mytableGroup by ID, Product
ORDER BY ID, Product, rptLevel, level
Note the ORDER BY applies to the entire UNION'd result set. Also, when
return the same number and types of columns. Thus, the need for a ' ' aslevel in the second.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.