SQLServer update select语句判断列值更新到另外一张表? 5
数据库是MSSQL两张表无关联字段,我这样写报错:当没有用EXISTS引入子查询时,在选择列表中只能指定一个表达式。updateT_BankListsetAvailabl...
数据库是MSSQL 两张表无关联字段,我这样写报错:当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。
update T_BankList set AvailableLimit=
(select SetsCash=(case when SetsCash <> 0 then AvailableLimit + SetsCash end ),Spending=(case when Spending <> 0 then AvailableLimit + Spending end ),
Installment=(case when Installment <> 0 then AvailableLimit + Installment end ),Repay=(case when Repay <> 0 then AvailableLimit - Repay end ) from dbo.T_Card_Details
where BillNo='TX201906071505180000' ) 展开
update T_BankList set AvailableLimit=
(select SetsCash=(case when SetsCash <> 0 then AvailableLimit + SetsCash end ),Spending=(case when Spending <> 0 then AvailableLimit + Spending end ),
Installment=(case when Installment <> 0 then AvailableLimit + Installment end ),Repay=(case when Repay <> 0 then AvailableLimit - Repay end ) from dbo.T_Card_Details
where BillNo='TX201906071505180000' ) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询