pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petru Ghita <petrutz@venaver.info>
To: Neil Stlyz <neilstylz@yahoo.com>
To: pgsql-sql mailing list <pgsql-sql@postgresql.org>
Subject: Re: string functions and operators
Date: Tue, 23 Mar 2010 02:50:10 +0100
Message-ID: <4BA81E52.9090200@venaver.info> (raw)
In-Reply-To: <22285.35517.qm@web113713.mail.gq1.yahoo.com>
References: <22285.35517.qm@web113713.mail.gq1.yahoo.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
That field of yours... what type is it?
Is it TEXT? is it a numeric type?
If it's TEXT, why don't you make it say... NUMERIC(/10/, /6///)?

http://www.postgresql.org/docs/8.4/interactive/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL


On 23/03/2010 2:20, Neil Stlyz wrote:
> Hello,
>
> I have a dilema and I was hoping someone here may offer guidance
> or assistance. I bet this is a very simple question for someone
> out there but I am having problems coming up with a solution. Here
> it is...
>
> suppose I have a field with the following values:
>
> 77.1 77.2 134.1 134.2 134.3 5.1 5.2
>
> I need two seperate SELECT queries. One would return the following
> values (everything left of the decimal point)
>
> 77 77 134 134 5 5
>
> The second query would return all of the values to the right of
> the decimal point:
>
> 1 2 1 2 3 1 2
>
>
> Now, I have been using the following information (although very
> Greek) to try to solve this problem:
>
> http://www.postgresql.org/docs/current/static/functions-string.html
>
>  And I have been playing around with the syntax of the following:
>
> substring('112.5' from '%#"___.#"_' for '#')
>
> but the aforementioned is not quite working out... can someone
> please show me a string function that will produce the desired
> results?
>
> Thanks! ~n
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
iEYEARECAAYFAkuoHlIACgkQt6IL6XzynQTJ/ACfX4mSteAz9CmZLnPCayz+jXQI
IhoAnA7qrFHNmRVObfSvE+YXZ0OKr3MS
=wvB9
-----END PGP SIGNATURE-----

view thread (9+ messages)  latest in thread

Message-ID: <4BA81E52.9090200@venaver.info>
Permalink:  ../4BA81E52.9090200@venaver.info/
Also on:    postgresql.org/message-id/4BA81E52.9090200@venaver.info

 · 

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: petrutz@venaver.info, neilstylz@yahoo.com
  Subject: Re: string functions and operators
  In-Reply-To: <4BA81E52.9090200@venaver.info>

* 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