为什么查询
DELETE FROM test
WHERE id = ( SELECT id
FROM (SELECT * FROM test) temp
ORDER BY RAND()
LIMIT 1
);
有时删除1行,有时2行,有时什么都不删除?
如果我以这种形式写:
SET @var = ( SELECT id
FROM (SELECT * FROM test) temp
ORDER BY RAND()
LIMIT 1
);
DELETE FROM test
WHERE id=@var;
然后正常工作-子查询是否有问题?
LIMIT
仅使用IN
(<code>替换为反引号〜drachenstern)