update a
set a.denialcharge_cost = b.denial_cost
, a.epd_cost = b.early_default_payment
, a.expeditecharge_cost = b.expeditecharge
, a.duediligence_cost = b.duediligence
, a.deskreview_cost = b.deskreview
, a.servicing_cost = b.servicingcharge
, a.mers_cost = b.merscharge
, a.qcplans_cost = b.qcplans
from orderheader a
inner join clients b
on a.prnt_id = b.id
我收到错误
Msg 512, Level 16, State 1, Procedure UpdateOrderHeader, Line 13
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
我在客户端有x个客户端...和订单中的订单数量。每个订单可以有1个客户端..每个客户端都可以有多个订单...订单中的prnt_id在客户端表中具有id。 ...任何帮助将不胜感激...我正在尝试复制denial_cost,early_default_payment,expeditecharge,duediligence,deskreview,servicecharge,merscharge,qcplans 从客户到订单负责人
答案 0 :(得分:2)
基于前一个问题的this answer以及我们所做的所有其他故障排除,看起来好像你有一个触发器阻碍了某个地方。尝试禁用它并运行更新。
答案 1 :(得分:0)
这样的东西应该有效(带格式化)
update orderheader
set denialcharge_cost = b.denial_cost,
epd_cost = b.early_default_payment,
expeditecharge_cost = b.expeditecharge,
duediligence_cost = b.duediligence,
deskreview_cost = b.deskreview,
servicing_cost = b.servicingcharge,
mers_cost = b.merscharge,
qcplans_cost = b.qcplans
from clients b
where orderheader.prnt_id = clients.id
答案 2 :(得分:0)
根据我对错误的理解,你试图只获取一个结果,某个地方并且子查询返回的不仅仅是一个字段。
喜欢
选择(从bb中选择*),因为来自cc的计数给出错误
因为子查询返回的内容多于嵌套查询中的字段