MySQL return first and last record for consecutive identical results
问题 I'm using MySQL and have a table called 'results' which stores the outcome of a monitor which determines whether a service is up or down at a specific time. +-----------+------------+---------------------+--------+ | result_id | service_id | time_stamp | result | +-----------+------------+---------------------+--------+ | 1 | 1 | 0000-00-00 00:01:00 | down | | 2 | 1 | 0000-00-00 00:02:00 | up | | 3 | 1 | 0000-00-00 00:03:00 | up | | 4 | 1 | 0000-00-00 00:04:00 | up | | 5 | 1 | 0000-00-00 00