I have a table user I need to update,
user table contains branchId and accountName. branchId is a fk reference on table branch, which contains institutionId. InstitutionId is a FK reference to institution table. Institution table contains name and id.
I want to update accountName in the user table to that user's equivalent institution name.
What I currently have is
update [user] set accountName = 
(Select i.NAME from institution i LEFT JOIN [branch] b on b.institution_id = i.id and b.id = branchId) 
but I'm getting
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.
I'm using mssql. 
I'm no pro using sql. Any help would be appreciated.
Thank you!.
 
     
    