笔记142 的存储过程crossjoin与表变量

笔记142 的存储过程crossjoin与表变量

 1 --的存储过程crossjoin与表变量
 2 declare @t1 table
 3 (c1 int,c2 int)
 4 
 5 declare @t2 table
 6 (c1 int, c3 int)
 7 
 8 insert into @t1
 9 SELECT 1,1 UNION ALL
10 SELECT 2,2 UNION ALL
11 SELECT 3,3
12 
13 
14 insert into @t2
15 SELECT 2,1 UNION ALL
16 SELECT 2,3
17 
18 
19 
20 select *
21 from @t1 a
22 inner join @t2 b on a.c1 = b.c1
23 
24 select *
25 from @t1
26 cross join @t2
27 
28 select *
29 from @t1,@t2

 

posted @ 2013-08-03 23:07  桦仔  阅读(189)  评论(0编辑  收藏  举报