pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ireneusz Pluta <ipluta@wp.pl>
To: Joshua <joshua@joshuaneil.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: simple SQL question
Date: Mon, 25 Jun 2007 17:33:29 +0200
Message-ID: <467FE049.9040008@wp.pl> (raw)
In-Reply-To: <467FD14F.7000302@joshuaneil.com>
References: <467FD14F.7000302@joshuaneil.com>



Joshua napisaƂ(a):
> 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?

if I read you correctly, I might suggest:

select round(your_column/100.0, 2) as divided_by_100 from your_table;

(note dividing by 100.0 (decimal), not just by 100 (integer))

> 
> Please let me know.
> 
> Thanks.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>               http://archives.postgresql.org
> 
> 
> 
> 




view thread (19+ messages)  latest in thread

Message-ID: <467FE049.9040008@wp.pl>
Permalink:  ../467FE049.9040008@wp.pl/
Also on:    postgresql.org/message-id/467FE049.9040008@wp.pl

 · 

reply

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: ipluta@wp.pl, joshua@joshuaneil.com
  Subject: Re: simple SQL question
  In-Reply-To: <467FE049.9040008@wp.pl>

* 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