CAST to DECIMAL in MySQL

后端 未结 5 584
甜味超标
甜味超标 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条回答
  •  猫巷女王i
    2020-12-23 12:13

    If you need a lot of decimal numbers, in this example 17, I share with you MySql code:

    This is the calculate:

    =(9/1147)*100

    SELECT TRUNCATE(((CAST(9 AS DECIMAL(30,20))/1147)*100),17);

提交回复
热议问题