What you want looks like something similar to pp. 407-410 in Graeme
Birchall's DB2 SQL Cookbook. I checked in the latest version, for DB2
9.5. That example should work in V5R4 SQL.
You can get Graeme's e-book (free) from his website:
This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact