Query to delete records that are before 90 days from today

B

bball

How do I in Access create a query to delete all the records that are in an
sql databasde before 90 days from todays' date?
Thanks.
I need to delete all records before Today minus 90, in other words we want
to keep the last 90 days worth.
 
A

Alex Dybenko

something like this:

Delete * from MyTable Where (Date()-MyTable.MyDateField) > 90
 
D

Douglas J. Steele

It might be marginally faster to use

Delete * from MyTable Where MyTable.MyDateField < Date() - 90

I think Jet is smart enough to know that it only has to figure out Date()-90
once, rather than doing the arithmetic for each row.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top