>Hi,>>I want to list items near a particular item in an indexed database,>e.g. if the items are ordered into>>a,b,c,d,e,f,g,h,i,j ... >>and I am looking for 'f' >>then I want the rows representing e,f,g or e,g,h if f does not exist,

What is the rule for governing which ones to return? Specifically, why
is h returned in the second example, and d not?

>Any help will be appreciated - The thing is I can't do >select * from table where id >= f-3 limit 5 --- or can I ,

Something like this

SELECT m1.* FROM
myTable AS m1, myTable AS m2
WHERE m2.id BETWEEN 'f' AND m1.ID
OR m2.ID BETWEEN m1.ID AND 'f'
GROUP BY m1.ID
HAVING count(*) <= 2