I'm fairly new to SQL and only know basic commands right now. I'm trying to get a value for a column 'position' in table 'role' based on the value of column 'salary' in table 'payroll'.
Table 'role' and 'payroll' contain three common columns 'employee_ID', 'first_name' and 'last_name' with common values. I want to use another column 'salary' in table 'payroll' to determine the output for column 'position' in table 'role'.
For example, if the 'salary' column in table 'payroll' has a value less than 2000, I want the 'position' column in table 'role' to display 'janitor'.
This is what I'm using.
update role
set position = 'janitor'
where (select salary from payroll) > 2000
And this is the error I'm getting.
#1242 - Subquery returns more than 1 row
I would really appreciate some help.