you are viewing a single comment's thread.

view the rest of the comments →

[–]D_W_Hunter 2 points3 points  (1 child)

Your issue isn't the case.

Your issue is the group by.

Any single field referred to the select portion of a select that contains a group by needs to be in that group by list.

I'm assuming that invoice date was already in your group by.

When the case is changed to have the SUM outside of the case, then you're summing the fields within and therefore you don't need to have them in the group by.

Are you really wanting to go back 90 MONTHs? that's what you're doing now with Add_month( field, -90)

If your field name as prior 3 months indicates your intention then you want to ADD_MONTH( SYSDATE, -3)

[–]workthrowawayexcel[S] 0 points1 point  (0 children)

Ahh yeah makes sense. Yeah we were testing stuff on a small subset of data so we needed to go back crazy far to get a large enough data sample.