|
Yes - simply leave out the "ROLLUP" keyword in that case
On Mon, Oct 31, 2022 at 9:12 PM Peter Dow<petercdow@xxxxxxxxx> wrote:
Hi Darryl,
I adapted the following from Example 3 at
https://www.ibm.com/docs/en/db2-for-zos/11?topic=subselect-examples-grouping-sets-rollup-cube-queries
SELECT co, account, invoice#, sum(amount)
FROM MyFile
GROUP BY ROLLUP (co, account, invoice#)
ORDER BY co, account, invoice#;
Co Account Invoice# Amount
AA 1234 Inv1 10.00
AA 1234 Inv2 15.00
AA 1234 - 25.00
AA - - 25.00
BB 5678 Inv3 20.00
BB 5678 Inv5 13.00
BB 5678 - 33.00
BB - - 33.00
- - - 58.00
I'm not sure if there's a way to eliminate the totals you don't want.
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.