select * from a,b where a.id=b.id
//如果你两个表之间有某种联系的话,如a.id=b.id
如果没有就是这样
select * from a,b
黙认是LEFT JOIN 就是将两个表按记录顺序联接在一起
//如果你两个表之间有某种联系的话,如a.id=b.id
如果没有就是这样
select * from a,b
黙认是LEFT JOIN 就是将两个表按记录顺序联接在一起
调试欢乐多
select id=identity(int,1,1),col2 into #t1 from Bselect col1,col2 from #t0 a full join #t1 b on a.id=b.iddrop table #t0,#t1
上面的得到的两列都是用sum和count函数得到的