Microsoft
Software
Hardware
Network
Question : How can I display previous month's records in January?
Hi Experts,
I'm using the following SQL to retrieve previous month's records:
SELECT * FROM ReportTable WHERE MonthOfReport LIKE '%" & MonthName(month(now)-1) & "%' AND YearOfReport like '2010'
How could I replace
YearOfReport like '2010'
with something that displays this year's records, but in January it dispays the previous year's December records.
I'd like to avoid updating the SQL every new year by typing in the actual year '2011' etc.
My goal is to display always the previous month's records.
Thank you very much.
Related Solutions:
How to request previous month's records in my sql's where clause?
Answer : How can I display previous month's records in January?
SELECT * FROM ReportTable WHERE MonthOfReport LIKE '%" & MonthName(month(now)-1) & "%' AND YearOfReport =
year(DATEADD(month, -1, getdate()))
Random Solutions
How to Create a Macro to remove blanks from Excel 2007 Worksheet
ASA 5505 Can VPN but cannot ping/connect to server or firewall.
MS Access crashes when exporting to PDF
unlock jailbroken iphone 3GS 3.1.3 model 5.12.01
desktop folders reappearing
Layout change in Access
Open Source PDF Library for VB.NET
Exporting kernel memory to user space using devmap_umem_setup
Cannot connect to Windows Update on Dell laptop
Addiing unallocated disk space to an aray