limit用法

limit是mysql的语法select * from table limit m,n

其中m是指记录开始的index,从0开始,表示第一条是指从第m+1条开始,取n条。

 

 select * from tablename limit 2,4即取出第3条至第6条,4条记录

mysql求前几条数据之和:

select sum(stats_unique_unique)
from
(SELECT stats_unique_unique from t_stats where fk_site = 9 limit 0, 7) a; 
select * from table limit 5; --返回前5行

select * from table limit 0,5; --同上,返回前5行

select * from table limit 5,10; --返回6-15行
posted @ 2018-09-26 20:04  四季万花筒  阅读(986)  评论(0编辑  收藏  举报