我想使用两个表的连接从数据表中选择不同的 GTIM 列值。这是我的查询..
SELECT TOP (9) Tracking.LAMI,
Tracking.LGMI,
Tracking.SPED,
Tracking.BAT_ADC,
Tracking.GTIM,
Tracking.MAIN_BACKUP,
Tracking.PULSE_CTR,
Tracking.NOST,
Tracking.IGST,
Tracking.COND_INPUTS,
Tracking.FUEL_ADC,
Tracking.M,
Vehicles_Device_Rel.VehicalNumber
FROM Tracking
INNER JOIN Vehicles_Device_Rel
ON Tracking.M = Vehicles_Device_Rel.Device_ID
WHERE (Vehicles_Device_Rel.VehicalNumber = 'test')
ORDER BY GTIM DESC
样本输出:
12.988000 77.68367400 6 543 2013-08-30 17:26:00.000 1 0.00 10 1 99 10 10 test
12.918800 77.65367400 6 543 2013-08-30 17:25:00.000 1 0.00 10 1 99 10 10 test
12.968800 77.65367400 4 543 2013-08-30 17:25:00.000 1 0.00 10 1 99 10 10 test
12.891880 77.65367400 6 543 2013-08-30 17:24:00.000 1 0.00 10 1 99 10 10 test