赞
踩
在开发过程中,需要对mysql数据库进行多表级联查询,其中为了提高分页查询性能,用到了mysql中查询行号。
SELECT * FROM table ORDER BY id LIMIT 1000, 10;
- SELECT * FROM table WHERE id BETWEEN 1000000 AND 1000010;
-
- SELECT * FROM table WHERE id IN(10000, 100300, 1000020...);
SELECT @rowno:=@rowno+1 as rowno,r.* from t_article r,(select @rowno:=0) t
SELECT @rowno:=@rowno+1 as rowno, O.* from (old_sql) O,(select @rowno:=0) t
select P.* from (SELECT @rowno:=@rowno+1 as rowno, O.* from (old_sql) O,(select @rowno:=0) t) P where rowno between ? and ?
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。