Trailing Zeros for decimal (12,2) on redshift query editor.

0

I could not find any official AWS documentation that specifically addresses the display of trailing zeros for decimal values in the Redshift Query Editor. However, based on my testing and experience, it seems that the Query Editor does not display trailing zeros for decimal values by default. My reporting layer requires price based on columns with 2 point precision. However, the trailing zeros aren't available. Is there a way to save them as e.g. 21.00, 10.20?

已提问 1 年前917 查看次数
1 回答
3

Start with TO_CHAR function to format

https://docs.aws.amazon.com/redshift/latest/dg/r_TO_CHAR.html and https://docs.aws.amazon.com/redshift/latest/dg/r_Numeric_formating.html

and the following example can help you

SELECT TO_CHAR(your_decimal_column, 'FM9999999990.00') AS formatted_decimal
FROM your_table;
profile picture
专家
已回答 1 年前
  • Hi @sdtslmn thanks so much for responding! We need the data to be in decimal for calculations. Is that not possible?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则