Dividing Money

From: Bob Dusek <bobd(at)palaver(dot)net>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Dividing Money
Date: 1998-12-01 19:09:17
Message-ID: Pine.LNX.3.96.981201135035.4461D-100000@temp.palaver.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey all,

I have been trying to figure out how to divide a data field of type
'money'. And, I've been unsuccesful. So, I have a couple of questions to
ask.

When I query my database, using 'select price from item_money;', postgres
returns just what I asked for....

(the first seven rows)

price
-------
$4.45
$2.95
$4.45
$2.95
$3.95
$3.95
$3.95

When I query my database using the query 'select price::float as price
from item_money', I get back some wierd stuff....

(the first seven rows)

price
----------
1080319164
1080319108
1080319052
1080318996
1080318940
1080318884
1080318828

In my first query results, the first row is the same as the third row.
And, the second row is the same as the fourth row. And, rows 5,6,7 are
all the same. However, in the results returned from my second query,
there are not any rows of equal value.... ???

Could someone explain this to me?

Thanks in advance,

Bob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ZioBudda 1998-12-01 21:39:55 better ?
Previous Message Michael A. Koerber 1998-12-01 17:38:50 initdb v6.4 "pg_atoi" error