3개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
1
Hi, it depends on what specifically do you want, with a similar example 0.6456524 and 3 decimals
- If you want to have a ceiling of the previous decimal value : 0.646 To do this you can use a UDF or this mathematic expression
CEIL((CAST(column1 AS double) / column2)*1000)/1000 as cvr
- if you want to have a floor of the previous decimal value : 0.645
FLOOR((CAST(column1 AS double) / column2)*1000)/1000 as cvr
- if you want to numerically round the previous decimal value : 0.646. To do this you can use
ROUND((CAST(column1 AS double) / column2), 3) as cvr
You can always refer to the Athena operations documentation here
답변함 2년 전
0
You can use ROUND(col, 3)
to round a number to three decimal points:
SELECT ROUND(CAST(column1 AS DOUBLE) / column2), 3) AS cvr
FROM my_table
답변함 2년 전