1
update ItinventoryR1 
set iin_userid = (select emp.empid 
                  from employee emp, itinventoryr1 it 
                  where ltrim(rtrim(it.iin_username)) in (emp.empname))

Error is :

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

2 Answers 2

1

I guess you need something like this:

UPDATE R1
SET iin_userid = emp.empid
FROM itinventoryr1 R1
INNER JOIN employee emp
    ON ltrim(rtrim(R1.iin_username)) = emp.empname

Join tables, and update one of them.

Sign up to request clarification or add additional context in comments.

Comments

1

Try this

update t1 
set t1.iin_userid =t2.emp_id
from ItinventoryR1 as t1 inner join employee emp as t2
on ltrim(rtrim(t1.iin_username))=t2.empname

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.