I have a time log table where all entries are entered with a time stamp and an event.
Now I want to select all the rows after a specific event AND ONE row before(ORDER BY time_stamp) that event.
I can easily achieve this with multiple queries, but is it possible with only one query ?
Using multiple queries
SELECT time
FROM table
WHERE event LIKE '%event_to_fint%'
SELECT event
FROM table
WHERE time<'time from last query'
LIMIT 1
ORDER BY
time DESC
One option is to
timerecords you need.timewhere this maximumtimeis less than the minimumtimefrom your regular select.SQL Statement