c. payne wrote:
	
		
			
				c. payne said:
			
		
	
	
		
		
			Trying to find a way to search records and return the lowest
ID/time where the next record is > 15 minutes after.
TIME	            ID
18:25:00	97
18:50:00	98
19:15:00	99
19:40:00	100
20:05:00	101
20:30:00	102
20:55:00	103
21:20:00	104
21:45:00	105
22:10:00	106
22:20:00	107
22:30:00	108
22:40:00	109
22:41:00	110
23:00:00	111
23:10:00	112
23:20:00	113
23:30:00	114
23:40:00	115
23:50:00	116
it should return ID 105
		
		
	 
What about ID = 97 (18:25:00)? The next time (18:50:00) is 25 mins
(i.e. > 15 minutes) later and its ID/TIME is lower than 105.
SELECT MIN(DT1.[TIME]) FROM
(
SELECT T1.ID, T1.[TIME], MIN(T2.[TIME])
FROM tblMain AS T1, tblMain AS T2
WHERE T1.[TIME] < T2.[TIME]
GROUP BY T1.ID, T1.[TIME]
HAVING DATEDIFF('n', T1.[TIME], MIN(T2.[TIME])) > 15
) AS DT1
Jamie.