Two table:
StoreInfo:
UserId uniqueidentifier
StoreNo nvarchar
UserName nvarchar
Password nvarchar
UserInfo:
UserId uniqueidentifier
UserName nvarchar
Password nvarchar
the UserId on StoreInfo is currently null. How do i update StoreInfo's UserId with UserInfo's UserId based on StoreInfo's UserName and Password is match to the UserName and Password from UserInfo.
the following is the query that i wrote which update the entire UserId in StoreInfo with the first UserId from UserInfo so i know it's wrong.
declare @UserName nvarchar(255)
declare @Password nvarchar(25)
declare @UserId uniqueidentifier
select @UserName = UserName, @Password = Password, @UserId = UserId
from UserInfo
select UserId, Password
from FranchiseInfo
where UserID = @UserName and Password = @Password
update FranchiseInfo
set UserI = @UserId