I know I start off every topic with this, but I am new to SQL (3.7 weeks in now). I have an update statement that I am putting in a stored proc and will setup a job to run once a month.UPDATE emp_time_tableSET time_accrued = (SELECT time_off.time_off_accrual_rate + emp_time_table_1.time_accrued AS new_time_accrued FROM time_off INNER JOIN emp_time_table AS emp_time_table_1 ON time_off.time_off_id = emp_time_table_1.to_type_id),last_updated = GETDATE()
The problem I am having is that I need this to run through the entire table and do this. It works fine when I have one row in my table, but when I added a second row, I got the following error:Msg 512, Level 16, State 1, Line 1Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.The statement has been terminated.