I am trying to perform a maths equation in SQL to calculate service up time. I have a column with pass counts and a column with fail counts.
I have achieved this sum in VB for the application side and the sum is as follows: pass / (pass+fail) * 100
.
The results should be on some rows 99.98 but I can't get SQL to give me the same result. I either get 100 or 0 as the result.
This is my SQL query:
select pass / sum(pass+fail) * 100 as total, friendlyname from sensors group by pass, friendlyname
Example row:
Friendly Name | Pass | Fail
_____________________________
Cloudflare | 25527 | 23
So as you can see the result should be 99.90 when done on a calculator using above formula but SQL reports this sum as 0.
Really would be grateful for some help!