sql to select top 10 records

mysql, pagination, sql

Solution

for the first page:

SELECT * FROM points p ORDER BY points DESC LIMIT 0, 5

for the second page:

SELECT * FROM points p ORDER BY points DESC LIMIT 5, 5

Problem

I have the following table (points): ``` recno uid uname points ============================ 1 a abc 10 2 b bac 8 3 c cvb 12 4 d aty 13 5 f cyu 9 ------------------------- -------------------------- ``` 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 ``` Thanks

Original source