Hi, I was hoping somebody could help me out with some mysql or mysql/php if it needs it. I have two tables in a mysql database.
Table1 has two fields 1) userref 2) payroll
Table 2 has two fields 1) userID 2) payroll_number
userref & userID are the same thing - the person's username. And payroll & payroll_number are the same thing - the person's payroll number.
I want to run some mysql which does the following. I want to take the userID from table2 and find the corresponding userref in table1. In other words for userID "Rupert" there will be a userref "Rupert" in table 1. So for the corresponding record in table1 I want it to check if "payroll" is different to "payroll_number". If it is the same then it need not be changed. However if it is different, I want "payroll" to be updated with the corresponding "payroll_number".
Would be grateful if somebody could give me some code.