在做SQL字段玉字段想减时出现"不能对 int 调用方法"的错误

来源:百度知道 编辑:UC知道 时间:2024/06/22 03:47:53
具体代码如下:
update Associator set
Associator.Integral=(select Integral from Associator where ID='Seq_10000023' ).Integral -(select sum(price*[Count]) as price from ShoppingCart where AssociatorID='Seq_10000023' and IsOperation='0').price

两个原因:
一,你所查找的数据类型不一样,所以不能进行运算操作;
二,你这个SQL语句有问题,也就是你所写的SQL语句语法有问题,应该是少写了个括号吧。

update Associator set
Associator.Integral=(select Integral from Associator where ID='Seq_10000023' )-(select sum(price*[Count]) as price from ShoppingCart where AssociatorID='Seq_10000023' and IsOperation='0')