'SQL Syntax Update Error With From and Inner Join [duplicate]

after a few time to find the error, i would ask u if anyone has some idea?

UPDATE benutzer_attributes 
SET benutzer_attributes.z_overlast_week = benutzer_attributes.z_last_week
FROM benutzer_attributes 
    INNER JOIN benutzer_groups ON benutzer_groups.ID = benutzer_attributes.ID
WHERE benutzer_groups.LEVEL = '4';

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 benutzer_attributes INNER JOIN benutzer_groups ON benutzer_groups.ID =' at line 3

Thanks und greetings!



Solution 1:[1]

MySQL does not use FROM in UPDATE. See UPDATE Statement, "Multiple-table syntax".

UPDATE benutzer_attributes 
INNER JOIN benutzer_groups ON benutzer_groups.ID = benutzer_attributes.ID
SET benutzer_attributes.z_overlast_week = benutzer_attributes.z_last_week
WHERE benutzer_groups.LEVEL = '4';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akina