declare @t1 as table(col1 int, col2 varchar(10)); insert ...

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(col1 int, col2 varchar(10));
insert into @t1
select 1, 'A' union all
select 2, 'A' union all
select 3, 'U' union all
select 4, 'A' union all
select 5, 'A';

declare @t2 as table(col3 int, col4 varchar(10));
insert into @t2
select 1, 'A' union all
select 5, 'U' union all
select 3, 'A';

select t1.col1, t1.col2, t2.col3, t2.col4
from @t1 as t1, @t2 as t2
where t1.col1 = t2.col3
and t2.col4 = 'U';

Enter Parameters

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