Lihat jawaban saya yang lain untuk solusi khusus MySQL, tetapi sangat cepat.
Solusi ini memungkinkan Anda menentukan jumlah baris teratas per lajur dan tidak menggunakan sintaks "funky" MySQL - ini harus berjalan di sebagian besar basis data.
select lane, series
from lane_series ls
group by lane, series
having (
select count(*)
from lane_series
where lane = ls.lane
and series > ls.series) < 2 -- Here's where you specify the number of top rows
order by lane, series desc;
Hasil pengujian:
create table lane_series (lane int, series int);
insert into lane_series values
(1, 680),
(1, 685),
(1, 688),
(2, 666),
(2, 425),
(2, 775);
select lane, series
from lane_series ls
group by lane, series
having (select count(*) from lane_series where lane = ls.lane and series > ls.series) < 2
order by lane, series desc;
+------+--------+
| lane | series |
+------+--------+
| 1 | 688 |
| 1 | 685 |
| 2 | 775 |
| 2 | 666 |
+------+--------+
4 rows in set (0.00 sec)