2013-06-30 44 views
1

我有這個疑問:選擇DBS信息和刪除(不工作)

DELETE FROM amx_admins_servers, amx_amxadmins 
WHERE 
    amx_admins_servers.admin_id = (SELECT id FROM amx_amxadmins WHERE username='kokoz') 
    AND amx_amxadmins.username = 'kokoz' 

,但沒有工作。

我收到SQL錯誤:

#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 'WHERE amx_admins_servers.admin_id = (SELECT id FROM amx_amxadmins WHERE username' at line 2

問題出在哪裏?

回答

0

看起來您想要刪除管理員用戶及其在服務器表中的所有條目。使用

DELETE a, s 
FROM amx_amxadmins a 
inner join amx_admins_servers s on a.id = s.admin_id 
WHERE a.username='kokoz' 
+0

謝謝!有用! –