Why do you need this?Where do you want to show these?If the table has identity or primary column then you can get desired resultDeclare @t table(id int identity(1,1),col1 varchar(10), col2 varchar(10))Insert into @t Select 'one' as col1, Null as col2Union allSelect 'one' as col1, Null as col2Union allSelect 'one' as col1, Null as col2Union allSelect 'one' as col1, Null as col2Union allSelect Null as col1, 'Two' as col2Union allSelect Null as col1, 'Two' as col2Union allSelect Null as col1, 'Two' as col2Union allSelect Null as col1, 'Two' as col2--sachinsamuel methodSelect distinct A.id,A.col1 + isnull(B.col1,'') as col1, B.col2 + isnull(A.col2,'') as col2 from (Select * from @t where col2 is null) a, (Select * from @t where col1 is null) b--Other methodselect distinct t1.id,t1.col1,t2.col2 from @t t1 cross join @t t2where t1.col1 is not null and t2.col2 is not null
MadhivananFailing to plan is Planning to fail