We can truncate any number to fixed decimal value by using truncate function in mysql. Here is the syntax
Here n is the number and D is the places upto which the number is to be truncated. We will try some examples.
SELECT truncate( 3.56, 1 ); // Ouput is 3.5
select truncate(8.7689,2); // output is 8.76
select truncate(342.87,0); // output is 342
Be the first to post comment on this article :
|More on Math functions in SQL|