This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决

这次国庆节回来后的测试中,在一个Mysql表达式中使用嵌套查询,出现了这个错误。原因是内层select语句带有limit子句。
在网上查了下,有文章指出:

比如这样的语句是不能正确执行的。

select * from table where id in (select id from table limit 12); 

但是,只要你再加一层就行。如:

select * from table where id in (select t.id from (select * from table limit 12)as t) 

这样就可以绕开limit子查询的问题。

问题解决。

后来我发现,上述是解决问题的一个方法,其实还有一个更好的做法,就是把限制条件放到from而非where子句中,就不必出现嵌套再嵌套。
如上例,可以改为:

select * from (select id from table limit 12) as foo;

注意:其实as foo特别重要,如果不写成from () as xxx的形式,即不给from后的select语句构成表名,那么最后系统仍会报错。

参考http://blog.chinaunix.net/uid-22414998-id-2945656.html

Mysql:Error Code 1235,This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决的更多相关文章

  1. Mysql:This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决

    From: http://blog.chinaunix.net/uid-22414998-id-2945656.html This version of MySQL doesn’t yet suppo ...

  2. MySQL Error Code文档手册---摘自MySQL官方网站

    This chapter lists the errors that may appear when you call MySQL from any host language. The first ...

  3. This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决

    在一个Mysql表达式中使用嵌套查询,出现了这个错误.原因是内层select语句带有limit子句.   在网上查了下,有文章指出: 比如这样的语句是不能正确执行的. select * from ta ...

  4. mysql-This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决

      这次国庆节回来后的测试中,在一个Mysql表达式中使用嵌套查询,出现了这个错误.原因是内层select语句带有limit子句.   在网上查了下,有文章指出: 比如这样的语句是不能正确执行的. s ...

  5. MYSQL ERROR CODE 错误编号的意义

    mysql error code(备忘) 转1005:创建表失败 1006:创建数据库失败 1007:数据库已存在,创建数据库失败 1008:数据库不存在,删除数据库失败 1009:不能删除数据库文件 ...

  6. Error code:1728 Cannot load from mysql.proc. The table is probably corrupted

    Error code:1728 Cannot load from mysql.proc. The table is probably corrupted http://bugs.mysql.com/b ...

  7. Mysql:1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'错误解决

    select distinct b.sale_count from product_sale b where b.pro_id in (select a.pro_id from product a L ...

  8. Mysql导入Sql文件时报Error Code: 2013 - Lost connection to MySQL server during query

    MySql 有时我们导入sql文件,文件过大,导致Error Code: 2013 - Lost connection to MySQL server during query这种错误 执行以下: S ...

  9. mysql: [ERROR] unknown variable 'datadir=/var/lib/mysql'问题

    环境: Centos7,mysql 5.7 问题: 在使用命令“mysql -u root -p”连接mysql时,报:“mysql: [ERROR] unknown variable 'datadi ...

随机推荐

  1. 2016/10/28 很久没更了 leetcode解题 3sumcloset

    16.3Sum Closest Given an array S of n integers, find three integers in S such that the sum is closes ...

  2. java去处重复输出

    去除重复输出问题:   数组:大量相同数据类型的集合 数据类型[ ] 数组名=new 数据类型[长度] 数据类型[ ] 数组名=new 数据类型[ ]{值1,值 2,值3.....} 数据类型[ ] ...

  3. oracle安装心得

    1.官网下载 oracle 11g r2 2.官网下载的oracle包括两个文件夹file1和file2,需要将解压后的file2中的stage-components文件夹下的内容复制到file1-s ...

  4. git 安装与配置

    Git服务器搭建 1. 环境部署 系统环境:服务器端:CentOS 6.5 ,ip:192.168.56.100 Master 客户端:CentOS 6.5 ,ip:192.168.56.101 Sl ...

  5. tar 压缩去除目录

    tar zcvf fd.tar.gz  *  --exclude=file1 --exclude=dir1 注意: 1.yes: --exclude=file1 no: --exclude file1 ...

  6. Spring的定时任务配置(转)

    spring的定时任务配置分为三个步骤: 1.定义任务 2.任务执行策略配置 3.启动任务 1.定义任务 <!--要定时执行的方法--> <bean id="testTas ...

  7. MongoDB 3.2 在windows上的安装

    翻译自 https://docs.mongodb.org/master/tutorial/install-mongodb-on-windows/ 在windows上安装 MongoDB 平台支持:从M ...

  8. [2011山东ACM省赛] Sequence (动态规划)

    Sequence Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Given an integer number sequence ...

  9. 第43讲:Scala中类型变量Bounds代码实战及其在Spark中的应用源码解析

    今天学习了scala的界定,先来看看下面这段代码 //class Pair[T] (val first : T,val second : T)class Pair[T <: Comparable ...

  10. (译)如何优化cocos2d程序的内存使用和程序大小:第二部分(完)

    前言:从上周发布教程的微博反应情况来看,cocos2der们对于游戏的内存问题还是非常关心的.本文是上一篇博文的续,旨在教大家如何减少cocos2d程序的大小. 全文如下: 减少你的程序的大小 把纹理 ...