79690532

Date: 2025-07-04 17:45:10
Score: 2.5
Natty:
Report link

What about this query? (https://dbfiddle.uk/ZTFhmLkt)

select id, "timestamp"
from t
where id = 100 
  and "timestamp" >= '2024-04-19 10:00:00'

union all

select id, "timestamp"
from (
    select id, "timestamp"
    from t
    where id = 100 
      and "timestamp" < '2024-04-19 10:00:00'
    order by "timestamp" desc
    limit 1
) as sub
  
order by "timestamp" desc;
id  timestamp
-----   ----------
100 2025-01-27 10:00:00
100 2025-01-26 10:00:00
100 2025-01-25 10:00:00
100 2024-04-20 10:00:00
100 2024-03-25 10:00:00
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What
  • Low reputation (1):
Posted by: Dmitry Diskin