我需要将两张表的count值并排罗列,用一个sql或视图表示该如何做。

例如:select count (*) from a,selec count(*) from b的结果要显示成
res1 res2
100 200

第1个回答  2012-04-18
create table #t (res1 char(20),res2(20))
insert into #t values('res1','res2')
insert into #t (convert(char,select count (*) from a),convert(char,select count (*) from b))
select * from #t
第2个回答  2012-04-18
select * from
(select count(*) res1 from a) a join
(select count(*) res2 from b) b
on 1=1本回答被提问者采纳
相似回答