views:

19

answers:

2

In my MySQL table Winners, I have a list of people who have won.

What I'd like to do is select a list of the names of 10 winners. So what I have right now is this:

SELECT name FROM Winners ORDER BY points DESC LIMIT 10

This returns the first 10 winners which is great.

But how can I make it (for example) return 10 winners, but starting at 20th place? Right now all I can think of is removing the LIMIT and programatically pulling out the 10 winners I want. But I'm sure there's an easier way.

+2  A: 
SELECT  name
FROM    Winners
ORDER BY
        points DESC
LIMIT 10 OFFSET 20 

or just

SELECT  name
FROM    Winners
ORDER BY
        points DESC
LIMIT 20, 10
Quassnoi
Thanks; nice and simple :) - Edit: I like that second one.
Cam
A: 
SELECT name FROM Winners ORDER BY points DESC LIMIT 20, 10
Alberto Zaccagni