I have like this columns in sql,
I want to sum TIME_Column hours in specific year.
Summation of output for 2019 should be like this;
12.5
Summation of output for 2020 should be like this;
14.0
Thank you for your help ppl
>Solution :
You can try to use DATEPART to get hours & minute numbers from your TIME_Column, the minute numbers might need division by 60, then do SUM aggregate.
SELECT DATEPART(YEAR, DATE_Column),SUM(DATEPART(HOUR, TIME_Column) + DATEPART(MINUTE, TIME_Column)/60.0)
FROM T
GROUP BY DATEPART(YEAR, DATE_Column)
NOTE
I would combine TIME_Column & DATE_Column to one column, there might no reason need to spite datetime to two column I think.
