A couple of problems with my prior post, changed below...

At/after V5R4 you can use the RANK function to pull only the top 10 by
library. You'd union your result with another query that included
SUM(). I'm not at V5R4 on the systems at my disposal.... Something
like:

WITH totrows as
(select odlbnm, sum(odobsz) as libsize
from mytable
where odobtp<>'*LIB'
group by odlbnm)
, topten as (select odobnm, odobtp, odobtp, rank(see manual) as
ranknbr
from mytable
...)
Select odlbnm, odobnm, odobtp, odobsz
From topten

Where ranknbr < 10

Union
Select odlbnm, '', '', libsize
From totrows
)
Order by odlbnm, odobsz desc

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady


I want to generate results like the following from a table with those
columns, however, the summary row does not exist. And, of the detail,
I
only want the 10 largest rows per library.

Library Object Size
BIGLIB 456789
BIGLIB BIGOBJ 200000
BIGLIB MEDOBJ 100000
BIGLIB SMLOBJ 50000
...
MEDLIB 322457
MEDLIB BIGOBJ 150492
MEDLIB MEDOBJ 54329
MEDLIB SMLOBJ 12222
...
SMLLIB 105298
SMLLIB BIGOBJ 102201
SMLLIB MEDOBJ 49
SMLLIB SMLOBJ 2
...



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 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.