如何删除适合要求的第一行? -Mysql(Mariadb)
我有这样的代码,
DELETE FROM queue WHERE id IN
(SELECT id FROM queue WHERE id=%s LIMIT 1)
但是当启动时,出现此类错误
此版本的Mariadb尚未支持'limit&在/all/任何/某些子查询'
您可以告诉我如何在没有标签中的标签的情况下做或完全不同?谢谢。
I have such a code,
DELETE FROM queue WHERE id IN
(SELECT id FROM queue WHERE id=%s LIMIT 1)
but when starting, such an error appears
This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
Can you tell me how to do without a tag IN
or to realize it at all differently? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Mariadb和MySQL允许子句(您应该使用)和
limit
在delete
语句:MariaDB and MySql allow an
ORDER BY
clause (which you should use) andLIMIT
in aDELETE
statement:您也许可以将逻辑作为DELETE加入而逃脱:
但是请注意,如果您使用的是
limit
,则实际上也应该使用订购订单。我已经在子查询中添加了一个占位符,以通过
子句为订单。
You might be able to get away with phrasing your logic as a delete join:
But note that if you are using
LIMIT
, you should really also be usingORDER BY
. I have added a placeholder in the subquery for anORDER BY
clause.