sql选择前10条记录
问题描述:
我有下表(点):
recno uid uname points
============================
1 a abc 10
2 b bac 8
3 c cvb 12
4 d aty 13
5 f cyu 9
-------------------------
--------------------------
我需要的是仅显示前十条记录,并按点(desc)排列,每页显示五条记录.我有以下SQL语句:
What I need is to show only the top ten records with by points (desc) and five records on each page. I have following the SQL statement:
select * from points where uid in(a,c) order by uid LIMIT 1, 5
谢谢
答
第一页:
SELECT * FROM points p ORDER BY points DESC LIMIT 0, 5
第二页:
SELECT * FROM points p ORDER BY points DESC LIMIT 5, 5