create table CallCost
(
Phoneno varchar(10),
Duration varchar(15),
Cost numeric(8,2)
)
insert into CallCost
select '9841645768','01:20:15',20
union all
select '9841645768','10:00:15',1
union all
select '9940272484','06:55:01',60
union all
select '9940272484','05:01:15',2
union all
select '9940272484','03:10:15',10
union all
select '9841645768','12:00:55',1
Select Phoneno,Sum(Datepart(hh,Duration))+Sum(Datepart(mi,Duration))/60+Sum(Datepart(ss,Duration))/360 as Hours,
Sum(Datepart(mi,Duration))%60+Sum(Datepart(ss,Duration))/60 as Minutes,
Sum(Datepart(ss,Duration))%60 As Seconds,Sum(cost) as TotalCost
From CallCost
Group By...