这是我需要转换为 MS Access 的 SQL Server 查询 -
declare @StartDateTime datetime, @EndDateTime datetime
set @StartDateTime = '8/17/2013 19:00:00'
set @EndDateTime = '8/18/2013 23:00:00'
WHILE @StartDateTime <> @EndDateTime
Begin
SELECT TOP 1 tablename.Field2, tablename.Field3
FROM tablename
WHERE tablename.SampleDate >= DateAdd(mi,0,@StartDateTime) And tablename.SampleDate <= DateAdd(mi,9,@StartDateTime)
SET @StartDateTime = DateAdd(mi,10,@StartDateTime)
if @StartDateTime = @EndDateTime
Break;
END
我很感激任何帮助。谢谢