I removed all of the group by on the top level query.
I removed all of the calculated fields on the top level query
I added back all of the fields except the sum of laborhours
Ran the query
then clicked groupby on all of the fields
Ran the query
I added back the LaborHours Calc.
It looks like this is a parser error which has been fixed. I am running a demo of 10.0.700.4 that i installed when it first came out. If I put a bad variable in your year field it gets caught, but if i do it in the second date field it errors out before finding the field.
Convert(varchar(4), OrderDtl.NeedByDate, 112)
and
Convert(varchar(2), OrderDtl.NeedByDate, 101)
respectively, instead of the datepart without removing anything, and now it works fine. I didn’t know that I could do it that way (sql less than novice here) so thanks for showing me that. I’ll just use that code instead in both places because it’s a lot cleaner way to get the 01 for the months to get them to sort correctly.