Andris Smits
Andris Smits

Reputation: 61

How to divide values in SQL statment

I have such statement in attachment and can anybody help me.

I need to divide the value of " CountUnSuccess" to "Count" and show that result in a statement. Could you please help, what I need to add in the statement in order that happens?

Thank you

SQL Statement Image

Upvotes: 1

Views: 253

Answers (1)

Stefan Steiger
Stefan Steiger

Reputation: 82196

How about

SELECT 
     COUNT(P2._total)/NULLIF(COUNT(p1.total)/100.0, 0.0) AS div

Alternatively

SELECT 
     COUNT(P2._total)*100.0/NULLIF(COUNT(p1.total), 0.0) AS div

Upvotes: 1

Related Questions