I have an SQL View which contains a column with dates of the '2012-06-21 19:44:50.543' format. I need to entre the condition to show only lines with dates starting from the beginning of the previous month. This procedure requires to use the current (inbuilt) time. Also I need such a View to be updated automatically each month. How can I do that?
To calculate the dates that match from the start of last month (remember, this is an example and may need modification with your code):
(Additional source: Terry Apodaca’s article, “SQL Dates – First, Current, Last Day of Month”, which moved from this old address to http://v1.terryapodaca.com/2008/01/28/sql-dates-first-current-last-day-of-month (or you can read an archived copy at the Wayback Machine).)