使用select语句更新查询

时间:2014-03-25 06:56:25

标签: sql

update DCC set DRR=
    (select cast((CAST((SUM(EMI)/100) AS DECIMAL(2,2))+CAST((SUM([REPO ARREAR])/100) AS DECIMAL(2,2))) as decimal(2,2))/((TOTAL*35)/100)/0.01 
    from dcc  
    where (CURR_DATE  BETWEEN '2014-01-01' and '2014-01-03') 
    GROUP BY TOTAL )

这是我的查询我必须使用select query将值存储在DRR中。

  

错误:子查询返回的值超过1。当子查询遵循=,!=,<,< =,>,> =或子查询用作表达式时,不允许这样做。   声明已经终止。

1 个答案:

答案 0 :(得分:0)

替换

select cast((CAST((SUM(EMI)/100) AS DECIMAL(2,2)

select TOP 1 cast((CAST((SUM(EMI)/100) AS DECIMAL(2,2)

更新行的列值时,需要为其提供单个标量值。