Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)

  • RE: Time Calculation

    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

  • RE: Time Calculation

    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

  • RE: Time Calculation

    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...

  • RE: How to add serial number to a resultset

    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.

Viewing 4 posts - 1 through 4 (of 4 total)