Reputation: 37
( SELECT SUM(misyukko.dataint11)
FROM misyukko
where syouhinid='$kokyakuorderbango'
) AS total_amount
For Example:
If the sum is 12345
it will be displayed as 123,45
If the sum is 12345678
it will be displayed as 123,456,78
How to solve it?
Upvotes: 2
Views: 86
Reputation: 521279
You could use REGEXP_REPLACE
here:
WITH yourTable AS (
SELECT 12345 AS num
)
SELECT RTRIM(REGEXP_REPLACE(num::text, '(\d{3})', '\1,', 'g'), ',') AS num_out
FROM yourTable;
Upvotes: 3