www.1862.net > sql负数转正数

sql负数转正数

select ABS(列名)from 表

update SPKCB set SL = -1*SL where SL < 0

假如原有的值获取: select [Amount] from orders 改成 select -[Amount] from orders 就是负值了。因为合理的amount应该是正的。 如果你担心万一出现了负的amount 用-abs([Amount])也可以

update [tablename] set SellNum = 0-SellNum where SellMode =2 and SellNum > 0 减法比乘法效率高,SellNum > 0 保证只转换正数。

case语句case when (Now()-[开始折旧时间])/30>0 then (Now()-[开始折旧时间])/30 else 0 end 已提月数大概是这样

SELECT WL, SUM(CASE WHEN SL > 0 THEN 1 ELSE -1 END) FROM TAB GROUP BY WL SELECT statement run complete. WL SUM 001 1 002 2 003 0 004 1- 如果按照你的显示的话,显示器为负数,显示为0,那么还要做多一步 SELECT WL, CASE WHEN SUM(CASE...

我大致知道什么意思了,楼主是想留下产品总数和批号的数量为正数的行数据。那楼主可以这样写: 第一种,汇总后筛选: select * from 产品批次表 a join (select 名称,sum(数量) as 总计数量 from 产品批次表 group by 名称)b on a.名称=b.名称 w...

update 123 set 456=abs(456) where id in (SELECT id FROM Inserted)

Select u_id,sum(case when field > 0 then field else 0 end) as 正数, sum(case when field < 0 then field else 0 end) as 负数, sum(case when field > 0 then field else 0 end) - sum(case when field < 0 then field else 0 end) as 实际...

select abs(QAA001) from 表名

网站地图

All rights reserved Powered by www.1862.net

copyright ©right 2010-2021。
www.1862.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com