Skip to content
Advertisement

how to use NULLIF with aggregate function

I’m using SQL Management Studio 2012. I’m getting a ‘Divide by zero error encountered’ error. I’m aware this requires the use of NULLIF but I’m unsure how to use it in my query.

This is my query

I’ve actually asked this question before which some kind person answered excellently but that was without the OVER() and SUM aggregate function, I’m getting in a muddle with the syntax. I’ve been trying various connotations of the below without success.

Advertisement

Answer

Use Case Expression to identify the 0 in prior

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement