Rounding result of expression in SELECT ..AS.. - Mailing list pgsql-novice

From Michael Rowan
Subject Rounding result of expression in SELECT ..AS..
Date
Msg-id C3C0596E-4466-4BB8-9A3F-7FE6DD543DF9@internode.on.net
Whole thread Raw
Responses Re: Rounding result of expression in SELECT ..AS..
Re: Rounding result of expression in SELECT ..AS..
List pgsql-novice
I have three columns in my table:
netcost integer(9,2)
taxsum integer(9,2)
quantity integer

In my SELECT I have:

SELECT (netcost+taxsum)*quantity AS totalcost FROM etc etc

My problem is that the value in totalcost is, like, 49.500000000000

SELECT round((netcost+taxsum)*quantity, 2) AS totalcost FROM etc etc

gives the same result.   What I want is 2DP, ie 49.50 in this example.  Is there a way to achieve this?

TIA and for past help.


Michael Rowan
mike.rowan@internode.on.net

11 Kingscote Street
ALBERTON
South Australia 5014

tel 618 8240 3993




pgsql-novice by date:

Previous
From: Pushpendra Singh Thakur
Date:
Subject: Re: Help with installing pgAdmin 3
Next
From: "Jean-Yves F. Barbier"
Date:
Subject: Re: Rounding result of expression in SELECT ..AS..