简体   繁体   中英

SQL how to round up to tenth (no decimals)

In Excel I use the ceiling function to round up to the tenth (or more) of a number, like for example:

38.4 =CEILING(A1,10), becomes 40

21 would become 30 etcetc..

In SQl you have a ceiling function but this only seems to round up decimals. Can I use this function or is there are different function I can use?

Thnx in advance!

使用天花板功能如下

CEILING(38.4/10)*10

I will give you some examples and I think you will understand.

ROUND(512.24, -1) Result=510,

ROUND(512.24, -2) Result=500,

ROUND(512.24, -3),Result=1000,

ROUND(123.9994, 3), Result=123.999,

ROUND(123.4545, 2), Result=123.45

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM