现在table里有这些字段和数据
ID Order Line
1 1 G1
1 2 G2
2 1 G2
2 2 G3
3 1 G3
3 2 G1现在想select出这样的组合ID Line Re
1 G2 G1->G2
2 G3 G2->G3
3 G1 G3->G1
请指教谢谢
ID Order Line
1 1 G1
1 2 G2
2 1 G2
2 2 G3
3 1 G3
3 2 G1现在想select出这样的组合ID Line Re
1 G2 G1->G2
2 G3 G2->G3
3 G1 G3->G1
请指教谢谢
from table1 a left join table1 b on a.id=b.id
where a.Order ='1' and b.Order='2'
from tb
group by id
select `id`,max(`order`),group_concat(`line` separator '->' ) from example group by id order by id asc
拿分结贴!
select id,max(line),group_concat(line order by 'order' asc separator '->')
from tb
group by id