Tambahkan ORDER BY ke pernyataan pilih SQL Anda
ORDER BY odometer ASCENDING
EDIT
OKE! Saya rasa saya mengerti masalah Anda sekarang.
SELECT t1.truck_id,
t1.odometer AS km1,
MIN(t2.odometer) AS km2
FROM fueldispensed AS t1,
fueldispensed AS t2
WHERE t2.truck_id = t1.truck_id
AND T2.odometer > t1.odometer
ORDER BY t1.truck_id,
t1.odometer
GROUP BY t1.truck_id,
t1.odometer
Harus memberi Anda sesuatu yang akan berhasil, meskipun tidak seefisien yang seharusnya
Edit pilihan truck_id Anda ke dalam kueri yang sesuai