Round Decimals and update in the same MySQL table

I have a MySQL table like this:
-------------------------------------------
|ID | Name | Value |
| 1 | Jack | 1.0382948092380932980293 |
| 2 | John | 12.3489245802843509384001 |
| 3 | Bill | 6.0293892838236487263872 |
-------------------------------------------

I want to update the values ​​to a three-digit decimal decimal, as the diagram below.
------------------------
|ID | Name | Value |
| 1 | Jack | 1.038 |
| 2 | John | 12.348 |
| 3 | Bill | 6.029 |
------------------------

How to do this using a MySQL clause? Thank.

+4
source share
1 answer

You need to use round:

update tablename set fieldname = round(fieldname,3) 
+3
source

All Articles