zoukankan      html  css  js  c++  java
  • 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锁定合作伙伴的价格表

  • 相关阅读:
    apache 错误日志
    搭建服务器
    vim配置
    临时表增加查询速度
    如何清空$_POST or $_GET
    hdu 2084
    快速幂
    zjut 1176
    rwkj 1091
    zjut 1090 --------同余定理的应用
  • 原文地址:https://www.cnblogs.com/jessi/p/4742902.html
Copyright © 2011-2022 走看看