I think Coy has given the best solution for what was asked. I just
wanted to mention a couple of additional things.
1. If for whatever reason, you had wanted to NOT get rid of
duplicates, then you would use UNION ALL. Without the ALL, UNION is
the same thing as UNION DISTINCT.
2. The union of two sets is another set, and as such there is no
guarantee that the order of the rows will be preserved. (With SQL,
you're encouraged to think of rows as inherently unordered, and if you
need to impose an order, then you do so explicitly with ORDER BY. It
so happens Db2 does give you the RRN function if you absolutely need
it, but I think it should be avoided if at all possible.)
John Y.
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.