Query dates older than 90 days? (1 Viewer)

gojets1721

Registered User.
Local time
Yesterday, 22:52
Joined
Jun 11, 2019
Messages
189
Any idea how to query entries whose date field is older than 90 days from whatever today's date is?

So essentially it'd remove entries with a date between 12/23/2020 - 3/23/2021....then tomorrow it'd filter 12/24/2020 - 3/24/2021 and so on
 
Last edited:

jdraw

Super Moderator
Staff member
Local time
Today, 01:52
Joined
Jan 23, 2006
Messages
14,425
Generally:
yourDate <Date-90
 

plog

Banishment Pending
Local time
Today, 00:52
Joined
May 11, 2011
Messages
10,998
Your explanation doesn't jive with your examples. So, here's SQL for the 2 things you asked for:


Any idea how to query entries whose date field is older than 90 days from whatever today's date is?

SELECT *
FROM YourTableNameHere
WHERE YourFieldDate>(Date()+90)

So essentially it'd filter out entries with a date between 12/23/2020 - 3/23/2021

SELECT *
FROM YourTableNameHere
WHERE (YourFieldDate<(Date() -90)) OR (YourFieldDate>Date())
 

gojets1721

Registered User.
Local time
Yesterday, 22:52
Joined
Jun 11, 2019
Messages
189
Your explanation doesn't jive with your examples. So, here's SQL for the 2 things you asked for:




SELECT *
FROM YourTableNameHere
WHERE YourFieldDate>(Date()+90)



SELECT *
FROM YourTableNameHere
WHERE (YourFieldDate<(Date() -90)) OR (YourFieldDate>Date())
Sorry...basically I don't want ones within the past 90 days to appear in the query

I inputted this sql but I'm getting no entries appearing

Code:
SELECT *
FROM EmployeeList
WHERE (((EmployeeList.[Hire Date])>(Date()+90)));
 

Minty

AWF VIP
Local time
Today, 06:52
Joined
Jul 26, 2013
Messages
9,363
Date() + 90 is 21/06/2021 (Proper date format ) ;)

That is 90 days in the future. I think you want a different calculation.

As Plog stated
Try WHERE (YourFieldDate<(Date() -90)) OR (YourFieldDate>Date())
 

Users who are viewing this thread

Top Bottom