Professional Web Applications Themes

To Anith - calculate the time - Microsoft SQL / MS SQL Server

my difficulty is to find the total value of the connections in the format hh:mm:ss. I get to find like this the time of the connections for each connection of the name: select convert(char, DHFimLigacao -DHInicioLigacao, 108) the TempoLigacao from controls. The one that I want is to add the total time of the connections contained by name in the format hh:mm:ss, and not the total time in minutes, or second. I go to research + a little and if I don't get, the way will be to place in that same format. "Anith Sen" <com> escreveu na mensagem news:u#phx.gbl... ...

  1. #1

    Default To Anith - calculate the time

    my difficulty is to find the total value of the connections in the format
    hh:mm:ss. I get to find like this the time of the connections for each
    connection of the name:
    select convert(char, DHFimLigacao -DHInicioLigacao, 108) the TempoLigacao
    from controls.
    The one that I want is to add the total time of the connections contained by
    name in the format hh:mm:ss, and not the total time in minutes, or second. I
    go
    to research + a little and if I don't get, the way will be to place in that
    same format.


    "Anith Sen" <com> escreveu na mensagem
    news:u#phx.gbl... 


    Frank Guest

  2. #2

    Default Re: To Anith - calculate the time

    Frank,

    I asked you to post your DDLs & sample data which you have deliberately
    ignored. Without that it is impossible to understand such requirements
    clearly. If I have to make a guess (again..)

    SELECT CAST(time / (60 * 60) AS VARCHAR) + ':' +
    CAST((time % (60 * 60)) / 60 AS VARCHAR) + ':' +
    CAST((time % (60 * 60)) % 60 AS VARCHAR)
    FROM (
    SELECT name, DATEDIFF(second, begintime, endtime)
    FROM tbl
    GROUP BY name ) D ( name, time ) ;

    --
    - Anith
    ( Please reply to newsgroups only )


    Anith Guest

  3. #3

    Default Re: To Anith - calculate the time

    the select is more or less like this:

    SELECT NOME, SOMARTEMPLIGACAO(CONVERT(CHAR, DATAFIMLIGACAO -
    DATAINICIOLIGACAO, 108)) FROM TABELA GROUP BY NOME.
    The format of the date that I would like is hh:mm:ss. I Already researched +
    I didn't get to solve.


    "Anith Sen" <com> escreveu na mensagem
    news:phx.gbl... 


    Frank Guest

Similar Threads

  1. How to calculate elapsed time ?
    By Stuart Clemons in forum PERL Beginners
    Replies: 8
    Last Post: January 28th, 01:28 PM
  2. Calculate Field for Sick Time
    By Connie in forum Microsoft Access
    Replies: 1
    Last Post: July 30th, 04:39 PM
  3. Calculate elapsed time in minutes
    By Dave - Freedonia in forum Microsoft Access
    Replies: 0
    Last Post: July 29th, 04:40 PM
  4. Calculate Time
    By Dave Elliott in forum Microsoft Access
    Replies: 1
    Last Post: July 27th, 10:02 PM
  5. calculate the time
    By Frank Dulk in forum Microsoft SQL / MS SQL Server
    Replies: 4
    Last Post: July 14th, 01:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139