如何在计算列中将负值转换为零? 我们有多个表的内连接,其中列是从表中取得的计算列,我需要将列中存在的负值转换为零,我该怎么办? 尝试了什么.. 我试过' case'但它不起作用。
我打算改变的代码部分类似于这个
(isnull((select isnull(sum(AVAILPHYSICAL),0) from ax.inventsum
where ITEMID = ax.INVENTTABLE.ITEMID ))-
(select isnull(sum(QTY*-1),0) from ax.RETAILTRANSACTIONSALESTRANS RTST inner join ax.RETAILTRANSACTIONTABLE RTT
on RTT.TRANSACTIONID = RTST.TRANSACTIONID
where ITEMID=ax.INVENTTABLE.ITEMID and (RTT.ENTRYSTATUS = 0 OR RTT.ENTRYSTATUS = 2) and
(RTST.TRANSACTIONSTATUS = 0 or
RTST.TRANSACTIONSTATUS = 2 ) and
As Quantity,