[thelist] SQL view construction

rudy rudy937 at rogers.com
Fri Sep 26 17:28:57 CDT 2003

> As an addendum I think my problem was trying to union 1 & 3 / 2 & 4
> then join - would that have made any difference?

probably not

UNION removes dupes (whereas UNION ALL keeps them in the result set)
but it's unlikely that you had duplicates between File1 (invoice headers)
and File3 (archived invoice headers)

doing the union first and then the join would have to look like this --

select headers.*, details.*
  from ( select * from file1 union all select * from file3 ) as headers
  join ( select * from file2 union all select * from file4 ) as details
    on headers.invoiceno = detailes.invoiceno

off the top of my head, that should work, but i haven't been on db2/400 for
quite a while...


More information about the thelist mailing list