shaheed313
shaheed313

Reputation: 305

Converting scientific notation to decimal in SQL Presto

I'm working with Amazon Athena and there are several columns that come out as scientific notation and I need it to come out as either an integer or a decimal. I've tried doing the answer from this: Convert exponential to number in sql

However, that doesn't work with SQL Presto, and this one doesn't work because I need it for multiple numbers, not just one: Query to convert exponential number to float in SQL Server

Upvotes: 6

Views: 11611

Answers (1)

Ricardo Mayerhofer
Ricardo Mayerhofer

Reputation: 2309

It should work if you cast the column to decimal.

SELECT CAST(doubleColumn AS decimal(22,2)) from my_table

There's no way to convert it globally.

Upvotes: 9

Related Questions