How to update values of an entire column in a table with respect to values of a column in another table with foreign key : MYSQL -
i have table named hours_worked has 2 columns, employeeid(primary key) , worked_hours_for_a_month. have table salary, has 2 columns attributes employeeid(foreign key of hours_worked), salary. want update salary attribute column values hours_worked(worked_hours_of_a_month) * 150 matching employeeid hours_worked , salary tables. want update entire column in 1 strike. possible?
update salary s left join hours_worked hw on hw.employeeid = s.employeeid set s.salary = hw.worked_hours_for_a_month*150
cheers :)
Comments
Post a Comment