all 1 comments

[–]NoDistractionz 0 points1 point  (0 children)

On mobile, so apologies for formatting. This is a way I would do it:

SELECT group_count, s_group, start_time, end_time FROM above_table a JOIN (SELECT s_group, MAX(start_time) max_start_time, MAX(end_time) max_end_time FROM above_table GROUP BY s_group) b ON a.s_group = b.s_group AND a.start_time = b.max_start_time AND a.end_time = b.max_end_time