|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how do I trim zeros off a double type field in mysql i.e. .2000 -> .2 and 2.2000 -> 2.2 and 2.222 -> 2.222 and 0.003450 -> 0.003450.
Thanx for the help Jacob Singh |
|
#2
|
|||
|
|||
|
FORMAT(X,D)
Formats the number x to a string with d decimals to a format like "nn,nnn.nnn". If d is 0, the result has no decimal point or fractional part. eg, SELECT FORMAT(double_numbers,2) AS rounded FROM tbl_name; I let SepodatiCreations tell you where I found that. [This message has been edited by billyo (edited October 04, 2000).] |
|
#3
|
||||
|
||||
|
A little birdie told you??
I don't think that solves his problem, though. That makes it a fixed number of decimal places, rather than just taking off the zeros. I'm not sure how to get rid of the zeros right as you select it out of the datbase. If you're using PHP, you could write a little routine that strips them off.... ---John Holmes... ------------------ ************************************************************* * The manual can probably answer 90% of your questions... * * * * PHP Manual. www.php.net/manual * * MySQL Manual: www.mysql.com/documentation/mysql/bychapter * ************************************************************* |
|
#4
|
|||
|
|||
|
yeah, thats what I thought, if you have the time to respond, could you send me an example of what the code would look like. I looked around in the php manual, but I'm a little shaky on string expressions
thanx J |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > how do I trim zeros off a double type field in mysql |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|