Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-12-2020 02:32 AM
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?
Solved! Go to Solution.
07-12-2020 03:02 AM
Hello @fhol
There are several ways:
RETURN (3.0 / 5.0) * 100 AS total
RETURN (toFloat(3) / toFloat(5)) * 100 AS total
Regards,
Cobra
07-12-2020 03:02 AM
Hello @fhol
There are several ways:
RETURN (3.0 / 5.0) * 100 AS total
RETURN (toFloat(3) / toFloat(5)) * 100 AS total
Regards,
Cobra
07-12-2020 03:55 AM
No problem, I'm happy to help, there are no bad questions
All the sessions of the conference are now available online