我真的缠在轴上。
我试图从表中删除一些记录
这不起作用......
delete from table where id in (select id from table where ...
...因为我得到了可怕的......
ERROR 1093 (HY000) at line 1: You can't specify target table for update in FROM clause
...所以我去了临时表选项......
create temporary table idTemp (idt bigint(20) unsigned); insert into idTemp select id from table where [...]; delete from table where id in (select idt from idTemp); drop table idTemp;
...仅在以root身份运行时才有效。如果我作为所需的用户运行,无论我给用户多少特权,我都会获得ACCESS DENIED 我尝试添加CREATE,DROP,INSERT,DELETE,SELECT并仍然获得ACCESS DENIED 但是当我尝试给用户CREATE TEMPORARY TABLES访问时,我得到了......
ERROR 1144 (42000): Illegal GRANT/REVOKE command
我在Linux上运行MySQL版本5.5.14 任何帮助将不胜感激!
答案 0 :(得分:0)
的MySQL>
GRANT ALL ON *.* TO 'someuser'@'somehost';
GRANT SELECT, INSERT ON *.* TO 'someuser'@'somehost';

答案 1 :(得分:0)
您还可以将原始查询标记为join
:
delete t
from table t join
(select id from table where ...
) todelete
on t.id = todelete.id;