Tuesday 19 May 2015

MS SQL - How to fix error - Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

Watch this example on YouTube:


in my case, replace
Select RecordID, (Select AdditionalAccount From Table2 Where
Table1.RecordID = Table2.RecordID) As AdditionalRec
From Table1

with

Select RecordID, (Select TOP 1 AdditionalAccount From Table2 Where
Table1.RecordID = Table2.RecordID) As AdditionalRec
From Table1

No comments:

Post a Comment