Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Grupo específico do MySQL por


Isso deve servir:
select name, min(time), max(time)
from (
select
name, 
time,
@group_num := if(@name != name, @group_num + 1, @group_num) AS group_number,
@name := name
from yourTable
, (select @group_num := 1, @name := NULL) variables
order by id
) sq
group by group_number