【问题标题】:How to keep the trailing zeros after decimal point如何保留小数点后的尾随零
【发布时间】:2021-09-13 16:52:58
【问题描述】:

所以我的 Alteryx 输出会截断小数点后的尾随零,这使我很难应用像 add "%" 这样的字符串操作

所以是这样的:

Alteryx Column

38.5

23.75

27

 Current Output by adding "%"

38.5%

23.75%

27%

Desired Output

38.50%

23.75%

27.00%

【问题讨论】:

    标签: sql types hive


    【解决方案1】:

    对于这些数字,您可以使用:

    format_number(col, 2) || '%'
    

    printf():

    printf('%0.2f%%', col)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多