+ -
当前位置:首页 → 问答吧 → 这段SQL写法有错吗?

这段SQL写法有错吗?

时间:2011-09-08

来源:互联网


各位大侠,帮忙看看这段SQL有错吗?~~~ 我弄不明白了!~~ 有不明白的地方可以问我谢谢了!
select 'N',
  oma01,
  ' ',
  ' ',
  '',
  isa01,
  oma23,
  isa08t - nvl(sum(tc_oob09), 0),
  isa08t * oma24 - nvl(sum(tc_oob10), 0),
  oma00,
  oma55,
  oma54t
  from (SELECT 'N',
  oma01,
  ' ',
  ' ',
  '',
  isa01,
  oma23,
  isa08t,
  isa08t * oma24,
  oma00,
  oma55,
  oma54t
  FROM omab_tmp, isa_file
  where isa04 = oma01) a,
  (select tc_oob16, nvl(sum(tc_oob09), 0), nvl(sum(tc_oob10), 0)
  from tc_ooa_file, tc_oob_file
  where tc_ooa01 = tc_oob01
  and tc_ooaconf <> 'X'
  group by tc_oob16) b
 where a.isa01 = b.tc_oob16(+)

作者: kingdomfx   发布时间: 2011-09-08

表结构你也不说明,错误你也不说,咋整

作者: opps_zhou   发布时间: 2011-09-08

isa08t - nvl(sum(tc_oob09), 0),
  isa08t * oma24 - nvl(sum(tc_oob10), 0),
里面的nvl(sum(tc_oob09), 0),
和这个 nvl(sum(tc_oob10), 0)需要建立别名使用,不能直接用

作者: yangqm22   发布时间: 2011-09-08