Re: remove everything before the period

From: Giuseppe Broccolo <giuseppe(dot)broccolo(at)2ndquadrant(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: remove everything before the period
Date: 2013-09-17 15:33:26
Message-ID: 52387646.3080703@2ndquadrant.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Il 17/09/2013 04:21, karinos57 ha scritto:
> Hi,
> I am trying to remove everything before the period in other words i only
> want to show the values that starts from the period. For instance
> 897.78 ==> 78
> 74.25 ==> 25
> 3657.256 ==> 256
>
> well the code below only shows everything before the period but i want to
> show everything after the period
>
> select volume, substring(volume from 1 for position('.' in volume) - 1) as
> column
> from MyTable ;
Try with: " SELECT volume, substring(volume from position('.' in volume)
+ 1) AS column FROM MyTable; "

Giuseppe.

--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe(dot)broccolo(at)2ndQuadrant(dot)it | www.2ndQuadrant.it

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam C Falkenberg 2013-09-17 15:51:52 Re: Using ODBC and VBA to pull data from a large object
Previous Message Luca Ferrari 2013-09-17 15:31:07 Re: How to compare the results of two queries?