您的位置:首页 > 数据库 > MySQL

MySQL也真是让人郁闷(关于子查询中使用limit)

2012-01-06 19:23 204 查看
作者: Laruence

原文地址: http://www.laruence.com/2008/07/16/227.html

在MySQL4.1中子查询是不能使用LIMIT的,手册中也明确指明 “This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery’ ”

也就是说,这样的语句是不能正确执行的。

select * from table where id in (select id from table limit 10);
但是,,但是,,,只要你再来一层就行。。如:

select * from table where id in (select t.id from (select * from table limit 10)as t)
你说说,MySQL是不是很让人无语??
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: