2

I'm looking to format a float so that it will be displayed in the following way:

999.999.990,00

I'm currently using the to_char function:

to_char(SUM(amount::float)/100, '999G999G990D00')

However this format is showing commas instead of dots. Such is the standard in Germany.

When I changed the G (used to symbolize a comma) to a D (used to symbolize a dot) I get the following error:

psycopg2.ProgrammingError: multiple decimal points

I'm running PostgreSQL and Psycopg2 with Python 2.7.

Any ideas how I can accomplish this replace?

Thanks

Andy K
  • 4,944
  • 10
  • 53
  • 82
OAK
  • 2,994
  • 9
  • 36
  • 49

1 Answers1

4

You can try the following

TO_CHAR(SUM(amount::float)/100,'FM99G999G990D00L')

It should give you the following results

55.123.854.547,10
3.123,58
-1.257.487,90
Andy K
  • 4,944
  • 10
  • 53
  • 82