select /*+ USE_HASH(T, W) */ w.hospital_name,
from (select /*+ USE_HASH(D1, E, C1) */ C1.hospital_id,
from mt_fee_fin D1,
bs_medi e,
mt_biz_fin C1,
bs_insured A1,
bs_corp_pres B1
where A1.indi_id = B1.indi_id + 0
AND A1.pers_type = :ln_pers_type
group by C1.hospital_id
union
select /*+ USE_HASH(A2, B2, C2) */ C2.hospital_id,
from bs_insured A2,
bs_corp_pres B2,
mt_biz_fin C2,
mt_pay_record_fin D2
where B2.indi_id = A2.indi_id
AND A2.pers_type = :ln_pers_type
group by C2.hospital_id) t,
bs_hospital w
where w.hospital_id = t.hospital_id
group by w.hospital_name在上述语句中,如何选择像w.hospital_name列一样选出 pers_type 列
谢谢
from (select /*+ USE_HASH(D1, E, C1) */ C1.hospital_id,
from mt_fee_fin D1,
bs_medi e,
mt_biz_fin C1,
bs_insured A1,
bs_corp_pres B1
where A1.indi_id = B1.indi_id + 0
AND A1.pers_type = :ln_pers_type
group by C1.hospital_id
union
select /*+ USE_HASH(A2, B2, C2) */ C2.hospital_id,
from bs_insured A2,
bs_corp_pres B2,
mt_biz_fin C2,
mt_pay_record_fin D2
where B2.indi_id = A2.indi_id
AND A2.pers_type = :ln_pers_type
group by C2.hospital_id) t,
bs_hospital w
where w.hospital_id = t.hospital_id
group by w.hospital_name在上述语句中,如何选择像w.hospital_name列一样选出 pers_type 列
谢谢
解决方案 »
- 保存Oracle脚本问题
- 请问一下oracle的insert操作是否随着数据量的增加,insert执行的速度就变慢了?
- 触发器问题
- ASP连接ORACLE出错 ORA-12541
- Oracle10g 的SQL*Plus出错
- 请教一个关于分布式数据库的问题
- 请教:表的主键与索引在概念上主要有什么区别?
- JSP中操作Oracle 的SQL语句跟操作Ms SQL2000 的SQL语句好象有什么不一样啊?
- 如何使字符型字段数值比如aaa-11排在aaa-2的后面???
- 菜鸟问题:oracle 如何显示所有的数据库
- 求救!!PL/SQL的问题 我都快郁闷死了 在线等
- PL/SQL的问题 在线等 救命啊!!
from (select /*+ USE_HASH(D1, E, C1) */ C1.hospital_id, 0 as pers_type
from mt_fee_fin D1,
bs_medi e,
mt_biz_fin C1,
bs_insured A1,
bs_corp_pres B1
where A1.indi_id = B1.indi_id + 0
AND A1.pers_type = :ln_pers_type
group by C1.hospital_id
union
select /*+ USE_HASH(A2, B2, C2) */ C2.hospital_id, A2.pers_type as pers_type
from bs_insured A2,
bs_corp_pres B2,
mt_biz_fin C2,
mt_pay_record_fin D2
where B2.indi_id = A2.indi_id
AND A2.pers_type = :ln_pers_type
group by C2.hospital_id) t,
bs_hospital w
where w.hospital_id = t.hospital_id
group by w.hospital_name
from (select C1.hospital_id,min(a1.pers_type) as pers_type
from mt_fee_fin D1,
bs_medi e,
mt_biz_fin C1,
bs_insured A1,
bs_corp_pres B1
where A1.indi_id = B1.indi_id + 0
AND A1.pers_type = :ln_pers_type
group by C1.hospital_id
union
select C2.hospital_id, min(a2.pers_type) as pers_type
from bs_insured A2,
bs_corp_pres B2,
mt_biz_fin C2,
mt_pay_record_fin D2
where B2.indi_id = A2.indi_id
AND A2.pers_type = :ln_pers_type
group by C2.hospital_id) t,
bs_hospital w
where w.hospital_id = t.hospital_id
group by w.hospital_name