我想運行更新查詢,似乎很簡單我已更新所有字段InitialCharge值'21 .61'無處不在當前InitialCharge = '20 .72',我也有其他合格的領域。我得到的錯誤:在TSQL拋出錯誤更新查詢
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
這裏是我的查詢,我試圖用「IN」和「存在」,但既不工作:
update [dbo].[tTransactionHistory]
set InitialCharge = '21.61'
Where exists(
select InitialCharge from [dbo].[tTransactionHistory]
where ProcedureID = '-747422922' and InitialCharge = ('20.72') and (DateOfService >= '09/01/2014' and DateOfService < '10/01/2014')
)
我甚至嘗試一個簡單的更新查詢,我得到的誤差,我從來沒有遇到這樣的問題,試圖只更新幾個領域
update [dbo].[tTransactionHistory]
set InitialCharge = '21.61'
where InitialCharge = '20.72'
你需要查詢相關,如果你使用的是存在 – TheGameiswar
我試着只是做了直線上升的更新以及使用不存在,或並得到該錯誤 –
您能否在這裏解釋邏輯?哪些記錄需要更新? – JohnHC