Select empno,sum(cast(substring(othours,0,3)as float)) as
Hour,sum(cast(substring(othours,4,5)as float)) as Minutes from tmstrans
group by empno,othours
它显示的数据如下
我需要以下数据
请帮助
答案 0 :(得分:3)
假设您要SUM
小时和分钟列,则必须从othours
子句中删除GROUP BY
列。像这样测试:
SELECT empno,
SUM(CAST(SUBSTRING(othours,0,3) AS float)) AS Hour,
SUM(CAST(SUBSTRING(othours,4,5) AS float)) AS Minutes
FROM tmstrans
GROUP BY empno