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
PC display unreadable when plugged into the TV?
Recommended Cisco Router for 100Mb Ethernet Handoff from Cogent
Verizon providing 6Mb tunnel using VWIC-2MFT-T1
Exchange 2010 email Traffic Reporting
The System Protection Tab is missing in Vista. How can I restore it?
Some differences between SQL Server 2005 and SQL Server 2008?
A substitute for Terminal Server running under 2003. Any 3rd party tool, having basic features of TS?
Need URGENT HELP PLEASE with ESEUTIL & Ex2007
Unix Tools: sed Command to Replace Text with TAB Character
reformating data returned