I have to select items in such a way, that when a certain news item is selected, I also need to select two older and two newer items with it (sorted by date). That would make 5 items in resultset, basically target item plus/minus two neighbours.
Is this possible with a single select?
Only way I can think of at this moment, would be to select target item, it's timestamp and then run two more selects. One with where timestamp older than the one from target item ORDER BY date DESC LIMIT 2, and one where date is newer than target timestamp ORDER BY date ASC LIMIT 2.
Any help appreciated.