Matt Wilhoite (11/10/2009)
A union generates more rows not more columns. Does this return what you expect?
SELECT col1, col2, col3 FROM Table1 WHERE (EXISTS (SELECT col5 FROM Table2 WHERE col1 =c5))
UNION ALL
SELECT col4, col5, col6 FROM Table2
There will only be 3 columns returned from this statement. Their headings would be col1, col2, col3. The data for col4, col5, col6 will be there but the first heaing will be used.
No :crying: it doesn't return what i was expecting hmm I was expecting a combination of all 6 columns but since UNION doesn't do this I will have to find another way, thanks for your help.