I have a query that selects 5 rows prior to the input datetime.
When the input datetime is close to the earliest date in my table I do not get 5 results, sometimes I get 4, 3, 2, 1 or none.
Is there a way to tell get it to select the remaining missing results (say the first query got 3 results so I need another 2) from random places in the table?
Assuming you want the results older than $date_selected, latest first,
read as:
Select those before the selected date by their date, then those after the selected date.