SQL - How do I get only the numbers after the decimal?

后端 未结 12 2106
清酒与你
清酒与你 2020-12-03 00:57

How do I get only the numbers after the decimal?

Example: 2.938 = 938

12条回答
  •  被撕碎了的回忆
    2020-12-03 01:12

    The usual hack (which varies a bit in syntax) is

    x - floor(x)
    

    That's the fractional part. To make into an integer, scale it.

    (x - floor(x)) * 1000
    

提交回复
热议问题