查询多个结果集
我现在有三个表 tb1 ,tb2, tb3 oracle数据库的
我现在要用一条sql语句,按条件查出三个表的汇总信息。
如:
select * from
{
col1=(select count(*) from tb1 where sql条件),
col2= (select sum(col) from tb2 where sql条件),
col3= (select sum(col) from tb3 where sql条件),
}d
查询结果就是
col1 col2 col3
4 5 6
类似这种查询,sql怎么写啊
------解决方案--------------------
select a.*,b.*,c.*
from
(select count(*) count_tb1 from tb1 where sql条件) a,
(select sum(col) sum_tb2 from tb2 where sql条件)b,
(select sum(col) sum_tb3 from tb3 where sql条件) c