答案 0 :(得分:1)
您可以使用内部联接并计算ID
@my_len = 3
select a.id as id, a.name as name, b.id as id1, b.name as name1, c.id as id2, c.name as name2
from my_table as a
inner join my_table as b where a.id = b.id+@my_len
inner join my_table as c where a.id = c.id+@my_len*2