Why gives this code next error on the last line?
Invalid column name 'rId'.
;WITH x AS
(
SELECT Id as rId
FROM Roles
WHERE Minimum >= (select punten
from Users
where id = 'abc')
)
INSERT INTO UserRoles (UserId, RoleId)
VALUES ('abc', rId);
I use MS-SQL server.