ql-ow...@postgresql.org] On
Behalf Of Neil Stlyz
Sent: Monday, March 22, 2010 9:17 PM
To: Petru Ghita; pgsql-sql mailing list
Subject: Re: [SQL] string functions and operators
This is good, however, I need only the numbers to the right of the decimal
point
so if my number if 17.2
I would need one query
trag von Petru Ghita
Gesendet: Dienstag, 23. März 2010 04:53
An: Neil Stlyz; pgsql-sql mailing list
Betreff: Re: [SQL] string functions and operators
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
For the record if you'd like to use regexp:
select substring('201.123' from $$[0-9]*$$
t;
>
>
>> just 2
>
>
>
>> Does that make sense?
>
>
>
>
> ----------------------
>
>
>
>
>
>
>
>
*From:* Petru Ghita
>> *To:* Neil Stlyz
> ; pgsql-sql mailing list
>
>> *
not 0.2
>
> just 2
>
> Does that make sense?
>
> --
>
>
>
*From:* Petru Ghita
> *To:* Neil Stlyz ; pgsql-sql mailing list
> *Sent:* Mon, March 22, 2010 8:08:30 PM
> *Subject:* Re: [SQL] string functions and operators
>
> For numeric data types
?
From: Petru Ghita
To: Neil Stlyz ; pgsql-sql mailing list
Sent: Mon, March 22, 2010 8:08:30 PM
Subject: Re: [SQL] string functions and operators
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
For numeric data types use:
http://www.postgresql.org/docs/8.4/static/functions-math.html
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
For numeric data types use:
http://www.postgresql.org/docs/8.4/static/functions-math.html
You could then use|floor|(dp or numeric)|| for example:
postgres=# select floor(71.912);
floor
- ---
71
(1 row)
postgres=# select 71.912-floor(71.91
-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