In a trip there are several stops, (a stop = an adress whereone or multiple orders are loaded, or delivered), in a specific order. For example:
Trip A
Trip_order Action Place Ordernumber
10 Load Paris 394798
20 Load Milan 657748
30 UnLoad Athens 657748
40 Unload Thessaloniki 394798
50 Load Thessaloniki 10142
60 Load Thessaloniki 6577
70 Unload Athens 6577
80 Unload Athens 10412
90 Load Thessaloniki 975147
100 Unload Paris 975147
I want to see the specific stops, in order of the trip:
Load Paris
Load Milan
Unload Athens
Unload Thessaloniki
Load Thessaloniki
Unload Athens
Load Thessaloniki
Unload Paris
I did look at This, but if I do that, I only get the unload Athens, unload Thessaloniki and Load Thessaloniki once.
How do I solve this?
EDIT: 11:11 (UTC +01:00) To be more specific: these are the tables which present this information:
Trips
Trip_ID
100001
100002
100003
....
Actions
Trip_ID Action MatNr RoOr RoVlg OrderID
100001 1 10 10 1 394798
100001 1 10 20 1 657748
100001 1 10 30 1 657748
100001 1 10 40 1 394798
100001 1 10 50 1 10142
100001 1 10 60 1 6577
100001 1 10 70 1 6577
100001 1 10 80 1 10412
100001 1 10 90 1 975147
100001 1 10 100 1 975147
(Action: 1=load, 4=unload) The combination of MatNr, RoOr and RoVlg is the order of the Trip.
Orders
OrderID LoadingPlace UnloadingPlace
6577 Thessaloniki Athens
10142 Thessaloniki Athens
394798 Paris Thessaloniki
657748 Milan Athens
975147 Thessaloniki Paris