The syntax of MSSQL drives us bonkers sometimes! Uugh!
So, we have a VIEW in MSSQL, that has the following fields (there are more in the VIEW...but these are the *pertinent* ones, for this exercise):
When we run a 'test' query (no sums, no groupings), we get the following
...which is *good*. However, when we attempt to (a) use SUMS within the CASE statements, and (b) GROUP the results by CATEG_COD...which is ultimately what is required...we continually get errors. An *example* of what we REALLY need follows:
Can anyone shed some light, and please provide us the *correct* syntax...to make this work...please? The "aggregate" functions tend to drive me batty. I'd truly appreciate it!...Thanks!...Mark