Re: simple division - Mailing list pgsql-general

From David G. Johnston
Subject Re: simple division
Date
Msg-id CAKFQuwZXO4WJqEbmWUtnCvDhRfVqYWbFx7bQ8D-Q-mxPRqEKgg@mail.gmail.com
Whole thread Raw
In response to Re: simple division  ("Joshua D. Drake" <jd@commandprompt.com>)
Responses Re: simple division
List pgsql-general
On Tue, Dec 4, 2018 at 1:38 PM Joshua D. Drake <jd@commandprompt.com> wrote:
> I may be misunderstanding the question but:
Indeed...
> select cast(x/y as numeric(10,4));

Your answer is 2.0 instead of the correct 2.5 - you need to cast
before the division, not after.

David J.


pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: simple division
Next
From: Rob Nikander
Date:
Subject: querying both text and non-text properties