mytable1 id mytable2 id idorder select id from mytable1 order by field

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mytable1
id
1
2
3
4
5
mytable2
id idorder
5 1
3 2
4 3
1 4
2 5
select id from mytable1 order by field(id,(select id from mytable2 order by idorder))