Hi friends. how can i fix that?
;with cte
as
(select distinct(e.Id )
from SecurityKmsAbfa..EnterprisePositions e
join SecurityKmsAbfa..Import_UsersTeh i on e.Name=i.vahedeSazmani
join NewKmsAbfa..Members m on m.SSN=i.kodeMelli
)
update SecurityKmsAbfa..users
set EnterprisePositionId = (select id from cte )
from SecurityKmsAbfa..Import_UsersTeh i
join NewKmsAbfa..Members m on m.SSN=i.kodeMelli
join SecurityKmsAbfa..users u on u.Id=m.id
where u.EnterprisePositionId is null
error:
Msg 512, Level 16, State 1, Line 3
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.