gpt4 book ai didi

Mysql删除顺序

转载 作者:IT老高 更新时间:2023-10-29 00:10:38 27 4
gpt4 key购买 nike

我有一张表,我只按 ID 的顺序显示最新的 30 行。

我正在尝试使用以下查询删除 30 条最新行之后的所有行。

DELETE FROM table WHERE type = 'test' ORDER BY id DESC LIMIT 30, 60

我在下面不断收到此错误

#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 ' 60' at line 1

我做错了什么?

最佳答案

试试这个,

DELETE FROM table
WHERE ID IN
(
SELECT ID
FROM
(
SELECT ID
FROM table
WHERE Type = 'TEST'
ORDER BY ID
LIMIT 30,60
) a
)

关于Mysql删除顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12382250/

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