?
Solved

How do I pull information from one month before the current date in MS Access using SQL?

Posted on 2009-04-05
2
Medium Priority
?
500 Views
Last Modified: 2012-05-06
I am using MS Access 2007 and trying to write this query using SQL and do not know how to pull the current date or subtract a month to it.
SELECT SalesNo.SaleNo, SalesNo.CustID, SalesNo.SaleDate
FROM SalesNo
WHERE ??? current date - one month ???
ORDER BY SalesNo.SaleDate;

Open in new window

0
Comment
Question by:jnreinsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 24074618
simple:
SELECT SalesNo.SaleNo, SalesNo.CustID, SalesNo.SaleDate
FROM SalesNo
WHERE SalesNo.SaleDate <= DATE()
  AND SalesNo.SaleDate >= DATEADD("m", -1, DATE())
ORDER BY SalesNo.SaleDate;

Open in new window

0
 

Author Closing Comment

by:jnreinsch
ID: 31566910
Thank you very much!
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question