mysql查询语句,通过limit来限制查询的行数。


例如:

select name from usertb where age > 20 limit 0, 1; //限制从第一条开始,显示1条

select name from usertb where age > 20 limit  1; //同上面的一个效果

select name from usertb where age > 20 limit 4, 1; //显示从第五条开始,显示1条


select name from usertb order by age desc limit 4; 倒序排列年龄,支线前4行

Logo

更多推荐