I am unable to format the below query intending to display the column-alias total re-formatted to display as dollars. Though unsuccessful, I suspect a nested solution combined with TO_CHAR
, is appropriate but I haven't succeeded with my attempts.
SELECT SUM(TO_CHAR(invoice_total,'999,999ドル.99')) AS "Total Invoice Amount"
FROM company.invoices;
Can anyone please assist? Thank you.
alexanderjsingletonalexanderjsingleton
asked Mar 2, 2016 at 22:32
1 Answer 1
This was a simple-syntax issue, which I unable to see due to my growing frustration-thank you.
SELECT TO_CHAR(sum(invoice_total),'999,999ドル.99') AS "Total Invoice Amount"
FROM company.invoices;
answered Mar 2, 2016 at 22:50
lang-sql
SUM(TO_CHAR(invoice_total))
does not make sense. You can't sum a varchar. You wantto_char(sum(invoice_total))
.