Saint Nick
Lifer
I have a report that runs monthly and posts prior month statistics. As of this month, it is not populating my tables. Here is my query.
I will step through how I think the bold line is processing.
month(12/1/2010) = month(1/11/2011) - 1
12 = 1 - 1
12 = 0
Is this a correct assumption? How can I get it to pull '12' instead of '0'?
Edit:
I decided just to hard code in the 12 for now. This is a once a year occurrence so I'll just suck it up 😛
Code:
[FONT=Courier New]
INSERT DVMS_FUEL_DRIVERS_FINAL (MonthYear,Weight,DriversFueling)[/FONT]
[FONT=Courier New]SELECT MonthYear,Weight,DriversFueling
FROM viewFuelDriversFinal
[B]WHERE month(MonthYear) = month(getdate())-1[/B][/FONT]
month(12/1/2010) = month(1/11/2011) - 1
12 = 1 - 1
12 = 0
Is this a correct assumption? How can I get it to pull '12' instead of '0'?
Edit:
I decided just to hard code in the 12 for now. This is a once a year occurrence so I'll just suck it up 😛
Last edited: