MySQL:尝试从 table 中删除时出现语法错误
MySQL: syntax error when trying to delete from table
因此,当客户 ID 为 100
时,我正在尝试 运行 以下代码从 table 中删除一条记录
DELETE FROM workoutplan
JOIN account ON workoutplan.Account_Username = account.Username
JOIN customer ON account.Customer_idCustomer = customer.idCustomer
WHERE Customer_idCustomer = 100
但是我收到以下错误
[Err] 1064 - 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 'JOIN account ON workoutplan.Account_Username = account.Username
JOIN customer O' at line 2
DELETE workoutplan
FROM workoutplan w
JOIN account
ON w.account_username = account.username
JOIN customer
ON account.customer_idcustomer = customer.idcustomer
WHERE customer_idcustomer = 100
因此,当客户 ID 为 100
时,我正在尝试 运行 以下代码从 table 中删除一条记录DELETE FROM workoutplan
JOIN account ON workoutplan.Account_Username = account.Username
JOIN customer ON account.Customer_idCustomer = customer.idCustomer
WHERE Customer_idCustomer = 100
但是我收到以下错误
[Err] 1064 - 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 'JOIN account ON workoutplan.Account_Username = account.Username
JOIN customer O' at line 2
DELETE workoutplan
FROM workoutplan w
JOIN account
ON w.account_username = account.username
JOIN customer
ON account.customer_idcustomer = customer.idcustomer
WHERE customer_idcustomer = 100