Solved

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

Posted on 2009-04-05
2
497 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
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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