How to get the total time of the records in a table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guizones
    New Member
    • Nov 2006
    • 1

    How to get the total time of the records in a table

    Hello,

    I have one table that has a column called CallDuration. This columns has always the format "1/01/2000 12:01:38 AM". The date part "1/01/2000" I want to discard, and sum the time part to get a total time in my query. How can I do that?

    Thx
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    select datediff(hour,' 1/01/2000 12:01:38 AM', '1/01/2000 11:10:38 AM') Hours,
    datediff(minute ,'1/01/2000 12:01:38 AM', '1/01/2000 11:10:38 AM') % 60 Minutes,
    datediff(minute ,'1/01/2000 12:01:38 AM', '1/01/2000 11:10:38 AM') TotalMinutes

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      select datediff(hour,m in(callduration ), max(callduratio n)) Hours,
      datediff(minute ,min(calldurati on), max(callduratio n)) % 60 Minutes,
      datediff(minute ,min(calldurati on), max(callduratio n)) TotalMinutes

      Comment

      Working...