Time limited query

JRPMD

Registered User.
Local time
Today, 11:34
Joined
Nov 24, 2012
Messages
52
Hello , I need a query that retrieves all records 24hs ahead from de first record .
The date added field in my table is in format :
6/5/2017 21:06:00
So,if the first record is in this moment I want only records until tomorrow , 7/5/2017 21:05:00.
I tried this : date < [Admission]+1 , but it doesn't work.
Can anyone helpme?
Thank you very much.
 
I think you will need to get the date for the criteria in a subquery something like

Code:
SELECT * FROM TheTableName
WHERE Admissions < 1 + (SELECT TOP 1 Admissions FROM TheTableName ORDER BY SortField);

where the SortField would be which ever field would get the right record on the top. You could also try DFirst instead of the subquery but it's not always reliable in that it's not clear what first means.
 
Hi Steve , thanks for your answer ; sorry I`m not skilled in SQL.
I prefer , if I would , to use the query criteria in MS Access.
May be my question wasn`t clear enough.
I made a query with this two tables :
.Admission , with this fields : Name , Id , Date_Admission.
-Events , with fields : Id , event , Date_event.

I want to establish in the criteria row a time limite of the first 24 hs for Date_event starting in Date_Admission.
Is it possible?
Thank you very much.
 
what about

WHERE Date_Event BETWEEN Date_Admission and Date_Admission+1
 

Users who are viewing this thread

Back
Top Bottom