Viewing 4 posts - 1 through 4 (of 4 total)
Another correction:
Select Phoneno,Sum(Datepart(hh,Duration))+Sum(Datepart(mi,Duration))/60+Sum(Datepart(ss,Duration))/3600 as Hours,
(Sum(Datepart(mi,Duration))%60+Sum(Datepart(ss,Duration))/60)%60 as Minutes,
Sum(Datepart(ss,Duration))%60 As Seconds,Sum(cost) as TotalCost
From CallCost
Group By Phoneno
July 15, 2008 at 12:35 pm
Correction:
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)%60 as Minutes,
Sum(Datepart(ss,Duration))%60 As Seconds,Sum(cost) as TotalCost
From CallCost
Group By Phoneno
July 15, 2008 at 12:32 pm
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...
July 15, 2008 at 12:22 pm
Please run this query:
select SubString(BatchId,3,1) as SlNo,BatchId,TransId Into NewTable
from OldTable
order by BatchId
I suppose you have varchar data type for BatchId.
July 8, 2008 at 1:56 pm
Viewing 4 posts - 1 through 4 (of 4 total)