首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

查询多个结果集,该如何解决

2012-02-24 
查询多个结果集我现在有三个表tb1,tb2, tb3oracle数据库的我现在要用一条sql语句,按条件查出三个表的汇总

查询多个结果集
我现在有三个表 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
 

热点排行