How can I correct this problem so that my MySQL code works correctly.
Here is my MySQL code that gives me the problem.
$q = \"UPDATE users INNER JOIN
I know it is an old question but it is the first link when googling this error. There is a workaround to solve this problem without performance issue (depending on your indexes) by using a derived table.
UPDATE table1 t1
JOIN (SELECT t1.id
FROM table1 t1
JOIN table2 t2 ON t1.id = t2.id
AND t2.some_criteria = 'some_value'
WHERE t1.other_criteria = 'other_value'
LIMIT 10000
) tmp ON tmp.id = t1.id
SET t1.field_to_update = 'new_value'
Because the LIMIT is inside the subquery, the join will match only the number of rows of the clause LIMIT. So the query will update only those rows.