Reputation: 455
Here is my SQL Server Query that needs to be converted to MS Access -
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
I appreciate any help. Thanks
Upvotes: 1
Views: 346
Reputation: 123409
That T-SQL script has no direct equivalent in Access. It returns multiple result sets, one for each 10-minute interval between @StartDateTime and @EndDateTime, each containing a single (apparently random) sample from that interval. Access queries only produce one result set (recordset).
If you update your question to explain what you actually want to do with those multiple result sets then we might be able to help you more, but for now the answer to
How can I convert this SQL Server query to an Access query?
is:
You can't.
Upvotes: 2