Thousands comma numeric formatting in psql

select trim(both ' ' from to_char(12345678.49, '999,999,999.99'))

The trim is to take away the white space from the sides.

Ref: https://www.postgresql.org/docs/9.6/static/functions-formatting.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s