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?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南