3 Risposte
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
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
con risposta 2 anni fa
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
con risposta 2 anni fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 2 anni fa