标签:查询 HERE esc desc XML div code 返回 复制
当前ID为5,读取上一条记录:
SELECT * FROM A WHERE ID < 5 ORDER BY ID DESC LIMIT 0,1;
ps: select * from table1 where id<$id order by id desc limit 1
当前ID为5,读取下一条记录:
SELECT * FROM B WHERE ID > 5 ORDER BY ID LIMIT 0,1;
ps: select * from table1 where id>$id order by id asc limit 1
查询前n行记录 select * from table1 limit 0,n; 或 select * from table1 limit n;
查询第一行记录: select * from table limit 1
查询第n行到第m行记录: select * from table1 limit n-1,m-n;
SELECT * FROM table LIMIT 5,10;返回第6行到第15行的记录
select * from employee limit 3,1; // 返回第4行
标签:查询 HERE esc desc XML div code 返回 复制
原文地址:https://www.cnblogs.com/guo10432/p/13430483.html