Solved

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

Posted on 2009-04-05
2
493 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 142

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

809 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