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 Shutdown an EMC Centera
How to make a secret key for crypto?
Limit output length of a regular expression
Remove Shutdown Option From Windows 7 Start Menu
Delphi 7 not starting
ISA 2006 Server configuration of second intenal network
SharePoint 2010 Webpart Request
Oracle SQL -- WHERE NOT CLAUSE
Problems with this simple cookie demo
lookup table and stop a form opening if more than two entries match a criteria