Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Combine Two Result set

Author  Topic 

yaman
Posting Yak Master

213 Posts

Posted - 2009-05-15 : 03:53:03
Sir
I have two result set

I want to show result in one table .
1st result set return 5 column .
2nd result set return 6 column .

I can,t used join & Union .
Union - Both resultset not have number of column same .
Join Not used bcoz i result set some return no result .

What can i do sir pls help me out ......

Yaman

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-15 : 03:55:32
you still an use UNION, just add a dummy column there with NULL value

select col1, col2, col3, col4, col5, col6 = NULL
from result1

union all

select col1, col2, col3, col4, col5, col6
from result2




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-15 : 04:10:35
see the code i highlighted in red


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

yaman
Posting Yak Master

213 Posts

Posted - 2009-05-15 : 04:18:31
[quote]Originally posted by khtan

you still an use UNION, just add a dummy column there with NULL value

select col1, col2, col3, col4, col5, col6 = NULL
from result1

union all

select col1, col2, col3, col4, col5, col6
from result2



Thank u so much sir

Yaman
Go to Top of Page
   

- Advertisement -