修复oracle中的时间问题

Fix time issue in oracle

Table 如下所示:

预期答案如下:

编写一个 oracle 查询来修复 space 和 return hh:mm 格式。考虑同一组中的同一时间和 return 总计数

下面查询中的WITH子句只是为了测试;删除它,并在主查询中使用实际的 table 和列名。注意:count是保留关键字,不能是列名。我将其更改为 count_(带下划线)。

with
  test_data (srt_tm, count_) as (
    select '1:00'  ,   125 from dual union all
    select '01:00' , 19000 from dual union all
    select ' 01:00',    27 from dual union all
    select '4:00'  , 22000 from dual union all
    select '04:00' ,  1800 from dual union all
    select ' 04:00', 15000 from dual
  )
-- END OF TEST DATA; ACTUAL QUERY BEGINS **BELOW THIS LINE**
select lpad(trim(srt_tm), 5, '0') as srt_tm, sum(count_) as count_
from   test_data
group  by lpad(trim(srt_tm), 5, '0')
order  by srt_tm
;

SRT_TM    COUNT_
------  --------
01:00      19152
04:00      38800