unless you're on mysql 4.1 and can use subqueries, i suggest you run separate queries
for next in group:
Code:
select min(product_id)
from Products_grouped
where product_id >= 5
and group_id = 1
where 5 and 1 are the values for the product you're currently sitting on
similar query for previous in group