mysql - Decimal places in SQL -


I'm calculating percentages An example is coming down from 38589/38400

then the percentage 100 * (3858 9/38400) is something equal to 100.4 9 21875, but the result appears as 100.

How can I take it to display with the X number of decimal digits?

Similarly, should I work 2 to display as 2 .000000?

Thank you!

You can put it in a specific data type, which protects the data type as well Rounding for a certain precision Choose

  (100 * (3858 9/38400) as the decimal (10, 4))   

FYI Select <100> * 100 (* 3858 9/38400) # 100.4922 Returns, not cast 100 for me (2 as decimal (20.6) # Output: 2.000000 < / Code>

Comments