SQL的连接问题,请高手帮忙
1、select count(t1.id) as count1 from Table1 t1 where condition1
2、select count(t2.id) as count2 from Table2 t2 where condition2
上面两条语句是在同一个表中查询出两个结果,比如:
语句1得到结果为10
语句2得到结果为20
我现在希望得到下面的结果:
count1 count2
10 20
我用left join好象有问题
select tt1.count1,tt2.count2 from
(select count(t1.id) as count1 from Table1 t1 where condition1) tt1
left join
(select count(t2.id) as count2 from Table1 t2 where condition2) tt2