I've the following in a query:
RETURN (3/5)*100 as total
current output: 0
desired output: 0.6
The problem is that it rounds decimal numbers to the lowest integer, so this way I can never compute a percentage. Does anyone know how to change this?
I've the following in a query:
RETURN (3/5)*100 as total
current output: 0
desired output: 0.6
The problem is that it rounds decimal numbers to the lowest integer, so this way I can never compute a percentage. Does anyone know how to change this?
Hello @fhol
There are several ways:
RETURN (3.0 / 5.0) * 100 AS total
RETURN (toFloat(3) / toFloat(5)) * 100 AS total
Regards,
Cobra
@cobra Such a newbie question but really helpful for a beginner, thanks!
No problem, I'm happy to help, there are no bad questions