Skip to content
Advertisement

How to Replace NULL Value with 0 (Zero)?

I’ve just got myself stuck with some SQL query and I’m quite new on this. I’m using pivot in my query.

This is my SELECT query:

and this is the output:

And this is my query with PIVOT.

This is the output:

Now my problem is how can I replace the NULL values with 0.

Advertisement

Answer

Just use conditional aggregation:

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