3 Respostas
- Mais recentes
- Mais votos
- Mais comentários
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
respondido há 2 anos
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
respondido há 2 anos
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos