MySQL - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘

Posted 放羊的牧码

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘相关的知识,希望对你有一定的参考价值。

问题描述

在一次业务中需要临时处理下业务绑定关系,方便排查问题,所以直接操作 mysql 需要写更新语句,但是想一批一批的来排查缩小范围,于是有了下面这条 SQL,一运行,直接报错(MySQL版本:5.7.20)

This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘

UPDATE t_demo
SET foreign_id = '8bb4d552a13ea3147159bd7f5d5ca851'
WHERE id IN
(SELECT id FROM t_demo WHERE foreign_id = '#' LIMIT 0, 10)

解决方案

在中间插入一个子查询来代替,什么意思呢?直接上 SQL,这样即可绕过以上报错,完美~

UPDATE t_demo
SET foreign_id = '8bb4d552a13ea3147159bd7f5d5ca851'
WHERE id IN
(SELECT * FROM (SELECT id FROM t_demo WHERE foreign_id = '#' LIMIT 0, 10) A)

以上是关于MySQL - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘的主要内容,如果未能解决你的问题,请参考以下文章

MySQL - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘

MySQL - This version of MySQL doesn‘t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery‘

This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery

MySQL8子查询提示:This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery

This version of the rendering library is more recent than your version of ADT plug-in

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa