56,677
社区成员
发帖
与我相关
我的任务
分享
create table table1
(id int,num int);
insert into table1
values(1,12),(2,13),(3,33),(4,24),(5,43),(6,13),(7,56),(8,87),(9,27),
(10,92),(11,24),(12,92),(13,13);
select num,group_concat(id order by id) as idstr from table1 group by num
---能解决一半吧。你业务端再取idstr 串解析一下 取串之间的最大差就可以了。