From: Fernando Hevia <fhevia@ip-tel.com.ar>
To: 'manchicken' <manchicken@notsosoft.net>
To: pgsql-sql@postgresql.org
Subject: Re: simple SQL question
Date: Mon, 25 Jun 2007 12:19:49 -0300
Message-ID: <04c701c7b73c$46595990$8f01010a@iptel.com.ar> (raw)
In-Reply-To: <200706251005.30120.manchicken@notsosoft.net>
> > I have a column with the following values (example below)
> >
> > 5673
> > 4731
> > 4462
> > 5422
> > 756
> > 3060
> >
> > I want the column to display the numbers as follows:
> >
> > 56.73
> > 47.31
> > 44.62
> > 54.22
> > 7.56
> > 30.60
> >
> > I have been playing around with string functions but cannot seem to
> > figure out a quick solution. Does anyone have any suggestions?
>
> Don't use to_char unless you actually want character data though.
>
> Just try this...
>
> SELECT (column/100) FROM table;
Cast the column in order to get the decimal part:
SELECT (column::real/100) FROM table;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: fhevia@ip-tel.com.ar, manchicken@notsosoft.net
Subject: Re: simple SQL question
In-Reply-To: <04c701c7b73c$46595990$8f01010a@iptel.com.ar>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox