declare @t1 as table(id int, col1 varchar(1)); insert int...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @t1 as table(id int, col1 varchar(1));
insert into @t1
select 1, 'A' union all
select 2, 'B' union all
select 3, 'C';

declare @t2 as table(id int, col2 varchar(1));
insert into @t2
select 1, 'X' union all
select 3, 'Z';

select * from @t1 as t1
cross apply (select * from @t2 as t2 where t1.id = t2.id) as t3

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results