How do I get 5 records before AND after a record with a specific ID?

Posted by richleland on Stack Overflow See other posts from Stack Overflow or by richleland
Published on 2010-03-17T01:22:18Z Indexed on 2010/03/17 1:31 UTC
Read the original article Hit count: 355

Filed under:
|

I have a table named scores with the columns id and score. I want to access a specific record by its id as well as the 5 records before and after it. Is there a way in SQL to say "grab the score with the id of n and x items before and after it?"

© Stack Overflow or respective owner

Related posts about sql

Related posts about database-queries