• 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锁定合作伙伴的价格表

  • 相关阅读:
    mysql的增量备份与全备的脚本
    mysql5.7的密码
    mysql 修改root密码
    centos7上面安装MySQL
    centos7上开启路由转发
    python基础之3
    python基础之2
    深入浅出FPGA-2-让source insight 支持verilog HDL
    Verilog 1995 VS Verilog 2001
    环境搭建基础知识2(sublime text3中配置verilog语法高亮)
  • 原文地址:https://www.cnblogs.com/jessi/p/4742902.html
Copyright © 2020-2023  润新知