float to int

Started by Charles.Houover 18 years ago3 messagesgeneral
Jump to latest
#1Charles.Hou
ivan.hou@msa.hinet.net

how can i get the int value using the sql language? like this,

"select cost from my_money_table " , the data type of cost is float.

#2Edoardo Panfili
edoardo@aspix.it
In reply to: Charles.Hou (#1)
Re: float to int

Charles.Hou ha scritto:

how can i get the int value using the sql language? like this,

"select cost from my_money_table " , the data type of cost is float.

take a look at
http://www.postgresql.org/docs/8.2/static/sql-expressions.html
CAST ( expression AS type )
expression::type

Edoardo

--
Jabber: edoardopa@talk.google.com
tel: 075 9142766

#3Lew
lew@lwsc.ehost-services.com
In reply to: Edoardo Panfili (#2)
Re: float to int

Edoardo Panfili wrote:

Charles.Hou ha scritto:

how can i get the int value using the sql language? like this,

"select cost from my_money_table " , the data type of cost is float.

take a look at
http://www.postgresql.org/docs/8.2/static/sql-expressions.html
CAST ( expression AS type )
expression::type

Incidentally, float is about the worst data type to represent monetary amounts
that one can choose.

--
Lew