I have a list returning from select statement.
For example
select type, id
from userlist
returns:
type id
1 102
2 125
3 156
Now I want to assign variable values based on the type. Is it possible in single statement?
Like
SELECT
case when type = 1 then @frontenduser = id
when type = 2 then @backenduser = id
when type = 3 then @newuser = id
end
FROM
(SELECT type, id
FROM userlist) AS tbl1