I want to select a group of rows around a row matched on conditions, ie select a row and then return 5 records before and after it.
More info as requested (sorry bout that!)
Ok, so the table records lap times from a race. Laps are related to Users (users have many laps). I want to find the best lap time for a User then x number of best laps from UNIQUE users above AND below the required User's best lap.
Is this possible?
Given the very sparse data, I can only provide a very generic solution. Think of it as inspiration:
This method, however, does not guarantee that a row with
id = <id-to-select>is returned. It just returns the row "nearest" to this ID.Again, this is only meant as a source of inspiration.