SELECT
[s2].[id],
[sn].[serial_num],
[sn].[maxDate] ,
[a].[measured_left]
FROM
(SELECT
[s].[serial_num],
( SELECT MAX([date_time])
FROM [serial_numbers]
WHERE [s].[serial_num] = [serial_num] ) AS [maxDate]
FROM
[serial_numbers] AS [s]
GROUP BY [s].[serial_num]) AS [sn]
JOIN [serial_numbers] AS [s2]
ON [sn].[serial_num] = [s2].[serial_num]
AND [sn].[maxDate] = [s2].[date_time]
JOIN [audio_tester] AS [a]
ON [a].[serial_num] = [s2].[id]
ยังไม่ได้
ต้องเพิ่มเงื่อนไข
WHERE date_time between '6/8/2012' and '6/18/2012 8:05:59 AM'
and serial_num like 'P0FX15993X%'
and test_name = '[Signal to Noise - Lch]'