gpt4 book ai didi

php - 使用 where 条件删除一个表并连接到多个表

转载 作者:行者123 更新时间:2023-12-01 00:18:23 26 4
gpt4 key购买 nike

我正在尝试从 skills_jobs 表中删除一行

以下是我的查询

delete from skills_jobs skj inner join jobs j on skj.jobid=j.id inner join users u on u.id=j.userid where u.id=$userid

但它抛出以下错误;

Fatal error: Uncaught exception 'Exception' with 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 'skj inner join jobs j on skj.jobid=j.id inner join users u on u.id=j.userid wher' at line 1 query: delete from skills_jobs skj inner join jobs j on skj.jobid=j.id inner join users u on u.id=j.userid where u.id=41

最佳答案

您必须设置表,从中删除行,然后尝试:

DELETE skills_jobs from skills_jobs INNER JOIN jobs j ON skills_jobs.jobid=j.id INNER JOIN users u ON u.id=j.userid WHERE u.id=$userid

请参阅 https://dev.mysql.com/doc/refman/5.7/en/delete.html 中的“多表删除”部分

关于php - 使用 where 条件删除一个表并连接到多个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44002832/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com