Reputation: 43
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
it is showing data like following
i need data like following
please help
Upvotes: 0
Views: 47
Reputation: 66697
Assuming you want to SUM
both Hour and Minutes columns, you've to remove the othours
column from the GROUP BY
clause. Test it like this:
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
Upvotes: 3