左右内外 交叉连接 sql语句

declare @a table(a int,b int)
declare @b table(a int,b int)

insert @a values(1,1)
insert @a values(2,2)
insert @b values(1,1)
insert @b values(3,3)
select * from @a 
select * from @b
--左:
select * from @a Aa left join @b Bb on Aa.a=Bb.a
--右:
select * from @a Aa right join @b Bb on Aa.a=Bb.a
--
select * from @a Aa inner join @b Bb on Aa.a=Bb.a
--外:
select * from @a Aa full join @b Bb on Aa.a=Bb.a
--交叉连接
select * from @a  cross join @b

 

posted @ 2012-10-25 15:03  jungil  阅读(149)  评论(0编辑  收藏  举报