oracle 视图多表关联查询,

select distinct
t.id,
p.palias,
cname,
c.currency_unit,
t.company_name isp, --运营商名称
t.code buessies, --下游客户名称
t.country_code, --国家码
t.price, --价格
t.country, --查出国家
'1' gamecode,
to_char(t.receive_time,'yyyymmdd') cdate,
to_char(t.receive_time,'yyyymm') cmonth,
to_char(t.receive_time,'yyyy') cyear,
to_char(t.receive_time,'yyyy-mm-dd hh24:mi:ss') insertdate,
trunc(pt.one_income,3) priceRMB,--单条RMB收入 无附加坏帐率

s.bshark_local_income priceLocal, --黑鲨当地货币收入 已附加坏帐率
s.bshark_local_income * c.exchange_rate priceBshark, --黑鲨单条收入 当地货币*汇率
pt.partner_one_income pricePartner, --合作伙伴单条收入(RMB)
s.price totalPrice, --资费
trunc((c.exchange_rate*s.price),3) totalRMBPrice, --RMB资费
s.sp_name sp_name
from bs_dcb_message t,qgc_countrysp s ,qgc_country c,qgc_partner p,bs_price_table pt
where
lower(t.code)=lower(p.pname)
and lower(t.country_code)=lower(c.country_code)
and lower(s.isp)=lower(t.company_name)
and p.pname=t.code
and s.country_id = c.id --SP:通过SP的国家ID再次锁定SP
and pt.sp_id = s.id --通过SP找到对应的价格表
and pt.partner_id = p.id --合作伙伴:通过合作伙伴ID锁定合作伙伴的价格表

转载于:https://www.cnblogs.com/jessi/p/4742902.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值