Home >Database >Mysql Tutorial >Mysql limit子查询语句_MySQL

Mysql limit子查询语句_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:38:111029browse

bitsCN.com


Mysql limit子查询语句

 

(1)mysql limit 不支持子查询像下面这条语句无法执行 

SELECT * FROM b_c_s1 where CT_ID IN

(SELECT DISTINCT CT_ID FROM b_c_s1 LIMIT 0,2);

 

(2)应该在只查询外面再加一个查询 

 

   SELECT  * FROM b_c_s1 where CT_ID IN (SELECT a.CT_ID FROM

(SELECT DISTINCT CT_ID FROM b_c_s1 LIMIT 0,2) a)
 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn