How to do division in postgresql without it being truncated?

division , postgresql , database Philippines
  • 11 years ago

    Hello, my problem is how to do division in postgresql without it being truncated to an integer. The case here is: 3/2 should be 1.5 but the result is 1. I have checked the documentation and it says that the / operator truncates the result to an integer. So, is there another operator or function that does division without the result being truncated to an integer?

    Any help is greatly appreciated.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry