请教SUM的问题...
如果以下两个字段有负数值该怎样求和,代码如下:(代码有错请教..)应该怎样做?select b.cclass_id
case billtype when 11 then sum(-ysmoney) else sum(ysmoney) end as ysmoneytotool,
case billtype when 11 then sum(-(ysmoney-jsye)) else sum(ysmoney-jsye) end as ssmoneytotool,
ssmoneytotool/ysmoneytotool*100 as huikun
from vw_c_billidx b where b.billtype in(10,11,16,17,112,32)