Skip site navigation (1) Skip section navigation (2)

Re: simple SQL question

From: Derrick Betts <list(at)blueaxis(dot)com>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: simple SQL question
Date: 2007-06-25 14:55:35
Message-ID: 467FD767.30402@blueaxis.com (view raw or flat)
Thread:
Lists: pgsql-novice
If the column type is a float4 or a float8 you can execute a query like 
this:
   SELECT column_name/100 FROM table_name;

If the column type is other than that, you can cast it to a float and 
then perform the query.
   SELECT (column_name::float4)/100 FROM table_name;

Joshua wrote:
> 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?
> 
> Please let me know.
> 
> Thanks.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>       message can get through to the mailing list cleanly
> 
> 
> 



In response to

pgsql-novice by date

Next:From: Glenn DavyDate: 2007-06-25 15:02:44
Subject: Re: simple SQL question
Previous:From: JoshuaDate: 2007-06-25 14:30:34
Subject: simple SQL question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group