编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛  
 
全能 ASP / PHP / ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
发新话题
打印

请教SUM的问题...

请教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)

TOP

发新话题