CAST to DECIMAL in MySQL

后端 未结 5 575
甜味超标
甜味超标 2020-12-23 12:08

I am trying to cast to Decimal in MySQL like this:

CAST((COUNT(*) * 1.5) AS DECIMAL(2))

I\'m trying to convert the number of rows in a tabl

5条回答
  •  借酒劲吻你
    2020-12-23 12:14

    An alternative, I think for your purpose, is to use the round() function:

    select round((10 * 1.5),2) // prints 15.00
    

    You can try it here:

提交回复
热议问题