Hello,
I was reading other questions posted and found many examples to retrieve last month records. I am using Visual Studio 2008 query builder to retrieve records from an Access mdb and when I enter the following query it is displaying 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 extract last month records from an mdb?
This is a query I have, but it is giving me records from this month also amd just need 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.