When trying to perform this query:
>mysql_query("UPDATE contracts
SET x = '1'
FROM contracts
INNER JOIN employees
ON contracts.contract_employeeid=employees.employee_id
WHERE experience >= '6'") or die(mysql_error());
I get the following error message:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near FROM contracts INNER JOIN employees ON contracts.contract_employeeid=employees.employee_id WHERE experience >= ‘6’
In words, I need to set x=1 on the table “contracts” for the employees who have more than 6 years of experience (to do so, I need to join with the table “employees” on employee_id=contract_employeeid since their experience is stored in that table)
You can probably move the JOIN part of your query before the SET statements: