oracle 统计投资人基金持仓份额大于0的数据

统计SQL过程中,用到了sum,count 以及group by

 select vc_fundcode, vc_fundname, sum(sumshare), count(vc_custno) --统计某个基金下所有投资人的份额总数,以及投资人数量 并且按基金代码基金名称分组
   from (select a.vc_fundcode,
             
  sum(a.en_postshare) as sumshare, --以投资人为维度 统计总份额 as '别名'
                b.vc_fundname,
                c.vc_custno,
                c.vc_acconame
           from v份额流水表 a, t基金信息 b, t交易账户信息 c
          where a.vc_t交易账号 = c.vc_交易账号
            and a.vc_基金代码 = b.vc_基金代码
            and a.vc_fundcode = '基金代码' --and a.VC_TRADEACCO='交易账户'
            AND (vc_occurdate <= '20231231')
            AND (Vc_Sharevaliddate > '20231231')
         
  and a.en_postshare > 0 -- 筛选条件 份额大于0为有效客户
          group by a.vc_fundcode, b.vc_fundname, c.vc_custno, c.vc_acconame)
  group by vc_fundcode, vc_fundname;

PS:感谢罗叔、土豪协助。
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值