这是我的疑问:
select send_date
, sum(total_requests) as 'All'
, sum(portion_requests) as 'Subset'
, (sum(total_requests)-sum(portion_requests)) as 'Delta'
from f_stats
where send_date = '2015-01-22'
group by send_date
“total_requests”和“part_requests”元素是数字。这些数字的总和是数亿(例如500,000,000)。我的查询结果以不需要的格式返回。当我希望它们看起来像“650,945,378”时,它们看起来像“6.50945378E8”。
如何强制格式化?
答案 0 :(得分:2)
要将逗号放入数字中,您需要将其转换为字符串。您应该可以使用to_char()
函数执行此操作。类似的东西:
select to_char(sum(total_requests), '999,999,999,999') as total_requests