lets say I have 3 tables in my SQL database:
AspNetUserRoles - hold records that links user with role AspNetUsers - holds users AspNetRoles - holds roles
I wanted to update role assigned to user whose email is: some@email.com
I created this query and it works:
-- Update tester account role
Update AspNetUserRoles
Set RoleId = 4
From AspNetUsers as b Inner Join AspNetUserRoles as a
On a.UserId = b.Id Where b.Email = 'some@email.com'
Now, how to edit this query, instead of supplying RoleId (in this case 4), retrieve specific role ID from its table by specifying its name? AspNetRoles table has field 'name', I tried with another inner join but failed. Any help would be appreciated, thank you.