zhoujun.g 发表于 2018-10-21 09:28:40

SQL-HTMLDOM

  select u.fonds_code,
  u.year_code,
  u.yj,
  u.cq,
  u.dq,
  nvl(u.yj, 0) + nvl(u.cq, 0) + nvl(u.dq, 0) as wsfilezj,
  (
  selectsum(t.yj)   as tes from (
  select u.fonds_code,
  u.year_code,
  u.yj,
  u.cq,
  u.dq,
  nvl(u.yj, 0) + nvl(u.cq, 0) + nvl(u.dq, 0) as wsfilezj,
  sum(nvl(u.yj, 0)) as wswjyjhj,
  sum(nvl(u.cq, 0)) as wswjcqhj,
  sum(nvl(u.dq, 0)) as wswjdqhj
  from (select t. fonds_code,
  t.year_code,
  nvl(y.yjwjsl, 0) as yj,
  nvl(c.cqwjsl, 0) as cq,
  nvl(d.dqwjsl, 0) as dq
  from T_FILE_WSDA t
  left join (select yj.fonds_code, yj.year_code, count(1) as yjwjsl
  from T_FILE_WSDA yj
  where yj.retention_period = '1'
  and (is_delete = '0' or is_delete is null)
  and yj.year_code is not null
  group by yj.fonds_code, yj.year_code) y on y.fonds_code =
  t.fonds_code
  and y.year_code =
  t.year_code
  left join (select cq.fonds_code, cq.year_code, count(1) as cqwjsl
  from T_FILE_WSDA cq
  where cq.retention_period = '2'
  and (is_delete = '0' or is_delete is null)
  group by cq.fonds_code, cq.year_code) c on c.fonds_code =
  t.fonds_code
  and c.year_code =
  t.year_code
  left join (select dq.fonds_code, dq.year_code, count(1) as dqwjsl
  from T_FILE_WSDA dq
  where dq.retention_period = '3'
  and (is_delete = '0' or is_delete is null)
  and dq.year_code is not null
  group by dq.fonds_code, dq.year_code) d on d.fonds_code =
  t.fonds_code
  and d.year_code =
  t.year_code
  where (is_delete = '0' or is_delete is null)
  and t.year_code is not null
  and t.fonds_code = '0409'
  group by t.fonds_code, t.year_code, y.yjwjsl, c.cqwjsl, d.dqwjsl
  order by t.year_code) u
  where 1 = 1
  group by u.fonds_code, u.year_code, u.yj, u.cq, u.dq
  order by u.year_code
  ) t
  )
  as wswjyjhj,
  (
  selectsum(t.cq)   as tes from (
  select u.fonds_code,
  u.year_code,
  u.yj,
  u.cq,
  u.dq,
  nvl(u.yj, 0) + nvl(u.cq, 0) + nvl(u.dq, 0) as wsfilezj,
  sum(nvl(u.yj, 0)) as wswjyjhj,
  sum(nvl(u.cq, 0)) as wswjcqhj,
  sum(nvl(u.dq, 0)) as wswjdqhj
  from (select t. fonds_code,
  t.year_code,
  nvl(y.yjwjsl, 0) as yj,
  nvl(c.cqwjsl, 0) as cq,
  nvl(d.dqwjsl, 0) as dq
  from T_FILE_WSDA t
  left join (select yj.fonds_code, yj.year_code, count(1) as yjwjsl
  from T_FILE_WSDA yj
  where yj.retention_period = '1'
  and (is_delete = '0' or is_delete is null)
  and yj.year_code is not null
  group by yj.fonds_code, yj.year_code) y on y.fonds_code =
  t.fonds_code
  and y.year_code =
  t.year_code
  left join (select cq.fonds_code, cq.year_code, count(1) as cqwjsl
  from T_FILE_WSDA cq
  where cq.retention_period = '2'
  and (is_delete = '0' or is_delete is null)
  group by cq.fonds_code, cq.year_code) c on c.fonds_code =
  t.fonds_code
  and c.year_code =
  t.year_code
  left join (select dq.fonds_code, dq.year_code, count(1) as dqwjsl
  from T_FILE_WSDA dq
  where dq.retention_period = '3'
  and (is_delete = '0' or is_delete is null)
  and dq.year_code is not null
  group by dq.fonds_code, dq.year_code) d on d.fonds_code =
  t.fonds_code
  and d.year_code =
  t.year_code
  where (is_delete = '0' or is_delete is null)
  and t.year_code is not null
  and t.fonds_code = '0409'
  group by t.fonds_code, t.year_code, y.yjwjsl, c.cqwjsl, d.dqwjsl
  order by t.year_code) u
  where 1 = 1
  group by u.fonds_code, u.year_code, u.yj, u.cq, u.dq
  order by u.year_code
  ) t
  )
  as wswjcqhj,
  (
  selectsum(t.dq)   as tes from (
  select u.fonds_code,
  u.year_code,
  u.yj,
  u.cq,
  u.dq,
  nvl(u.yj, 0) + nvl(u.cq, 0) + nvl(u.dq, 0) as wsfilezj,
  sum(nvl(u.yj, 0)) as wswjyjhj,
  sum(nvl(u.cq, 0)) as wswjcqhj,
  sum(nvl(u.dq, 0)) as wswjdqhj
  from (select t. fonds_code,
  t.year_code,
  nvl(y.yjwjsl, 0) as yj,
  nvl(c.cqwjsl, 0) as cq,
  nvl(d.dqwjsl, 0) as dq
  from T_FILE_WSDA t
  left join (select yj.fonds_code, yj.year_code, count(1) as yjwjsl
  from T_FILE_WSDA yj
  where yj.retention_period = '1'
  and (is_delete = '0' or is_delete is null)
  and yj.year_code is not null
  group by yj.fonds_code, yj.year_code) y on y.fonds_code =
  t.fonds_code
  and y.year_code =
  t.year_code
  left join (select cq.fonds_code, cq.year_code, count(1) as cqwjsl
  from T_FILE_WSDA cq
  where cq.retention_period = '2'
  and (is_delete = '0' or is_delete is null)
  group by cq.fonds_code, cq.year_code) c on c.fonds_code =
  t.fonds_code
  and c.year_code =
  t.year_code
  left join (select dq.fonds_code, dq.year_code, count(1) as dqwjsl
  from T_FILE_WSDA dq
  where dq.retention_period = '3'
  and (is_delete = '0' or is_delete is null)
  and dq.year_code is not null
  group by dq.fonds_code, dq.year_code) d on d.fonds_code =
  t.fonds_code
  and d.year_code =
  t.year_code
  where (is_delete = '0' or is_delete is null)
  and t.year_code is not null
  and t.fonds_code = '0409'
  group by t.fonds_code, t.year_code, y.yjwjsl, c.cqwjsl, d.dqwjsl
  order by t.year_code) u
  where 1 = 1
  group by u.fonds_code, u.year_code, u.yj, u.cq, u.dq
  order by u.year_code
  ) t
  )
  as wswjdqhj
  from (select t. fonds_code,
  t.year_code,
  nvl(y.yjwjsl, 0) as yj,
  nvl(c.cqwjsl, 0) as cq,
  nvl(d.dqwjsl, 0) as dq
  from T_FILE_WSDA t
  left join (select yj.fonds_code, yj.year_code, count(1) as yjwjsl
  from T_FILE_WSDA yj
  where yj.retention_period = '1'
  and (is_delete = '0' or is_delete is null)
  and yj.year_code is not null
  group by yj.fonds_code, yj.year_code) y on y.fonds_code =
  t.fonds_code
  and y.year_code =
  t.year_code
  left join (select cq.fonds_code, cq.year_code, count(1) as cqwjsl
  from T_FILE_WSDA cq
  where cq.retention_period = '2'
  and (is_delete = '0' or is_delete is null)
  group by cq.fonds_code, cq.year_code) c on c.fonds_code =
  t.fonds_code
  and c.year_code =
  t.year_code
  left join (select dq.fonds_code, dq.year_code, count(1) as dqwjsl
  from T_FILE_WSDA dq
  where dq.retention_period = '3'
  and (is_delete = '0' or is_delete is null)
  and dq.year_code is not null
  group by dq.fonds_code, dq.year_code) d on d.fonds_code =
  t.fonds_code
  and d.year_code =
  t.year_code
  where (is_delete = '0' or is_delete is null)
  and t.year_code is not null
  and t.fonds_code = '0409'
  group by t.fonds_code, t.year_code, y.yjwjsl, c.cqwjsl, d.dqwjsl
  order by t.year_code) u
  where 1 = 1
  group by u.fonds_code, u.year_code, u.yj, u.cq, u.dq
  order by u.year_code


页: [1]
查看完整版本: SQL-HTMLDOM