I read other posted questions and found many examples for getting records from last month. I use the Visual Studio 2008 query builder to retrieve records from Access mdb, and when I enter the following query, it shows me an error that getdate is not a valid function:
where [Transaction Date] between dateadd(mm, datediff(mm, 0, dateadd(MM, -1, getdate())), 0) and dateadd(ms, -3, dateadd(mm, datediff(mm, 0, dateadd(MM, -1, getdate())) + 1, 0))
What is the correct SQL query to retrieve records last month from mdb?
This is a query that I have, but it gives me records from this month, and is also needed last month:
SELECT [Product Code], [Description One], [Transaction Number], Quantity, [Sales Value], Cost, [Transaction Date], [Transaction Time], Department, [Type Code], Cashier, [Computer Name], [Customer Code] FROM [Product History] WHERE ([Transaction Date] >= DATEADD('m', - 2, NOW()))
Any help is appreciated.