mySQL子查询限制
这可能是一个简单的…如何通过此查询实现我想要的结果:
delete from posts where id not in(SELECT id FROM posts order by timestamp desc limit 0, 15)
因此,简而言之,我想删除所有最新的15条信息。
当我尝试该查询时,我得到了
MySQL尚不支持’LIMIT&IN / ALL / ANY / SOME子查询
编辑
mySQL Server version: 5.5.8mySQL Client version: mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $
错误:#1235-此版本的MySQL尚不支持“ LIMIT&IN / ALL / ANY / SOME子查询”
回答:
尝试这个:
DELETE FROM posts
WHERE id not in (
SELECT * FROM (
SELECT id
FROM posts
ORDER BY timestamp desc limit 0, 15
)
as t);
以上是 mySQL子查询限制 的全部内容, 来源链接: utcz.com/qa/408953.html