Seems that I have been knocked off of the DB2-L listserv.

I am doing a union of three queries where it is possible that the critical
columns are in more than one of the queries.

For example:

                 select col1, col2 col3, 'source 1'
                          from table1
                          where something
                 union
                 select col1, col2, col3,, 'source 2'
                           from table2
                          where something
                 union 
                 select col1, col2, col3, 'source 3'
                            from table3
                            where something

I would like a single row even if the data (col1, col2, col3) is in more than
one of the queries, so that 'source1' is returned if in table1 and table2
and/or table3, 'source 2' if not in table1 but in table2 (and perhaps table3)
and 'source 3' if only in table 3.

--
Binyamin Dissen <[email protected]>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to