Results 1 to 4 of 4

Thread: SQL Help

  1. #1
    Join Date
    Sep 2006
    Posts
    97

    Unanswered: SQL Help

    Let me admit I am not good at SQL and I need help. I want the sum of connections with in min and group my time order by time

    connections Time
    36556 09:13:00
    36812 09:13:00
    37310 09:13:00
    37746 09:13:00
    38547 09:13:00
    38906 09:13:01


    I would like ot get it inthis format using SQL


    Totconnections Time

    225877 09:13

  2. #2
    Join Date
    Sep 2006
    Posts
    97
    db2 "select sum(connections)as Totconnections , ifs_server_tm as Time from ANDT.SESTATS01 where IFS_SERVER_dt = CURRENT DATE group by IFS_SERVER_TM order by IFS_SERVER_TM "

    I am getting data

    186971 09:13:00
    38906 09:13:01

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    something like this
    (0)[db2inst1@dlx00031 thebrain]$ db2 "select sum(connections),substr(char(ctime),1,5) from tt group by substr(char(ctime),1,5) order by 2"

    1 2
    ----------- -----
    600 09:13

    1 record(s) selected.

    (0)[db2inst1@dlx00031 thebrain]$ db2 "select * from tt"

    CONNECTIONS CTIME
    ----------- --------
    100 09:13:00
    200 09:13:01
    300 09:13:02

    3 record(s) selected.
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #4
    Join Date
    Sep 2006
    Posts
    97
    thank you so much przytula for your help.

    It worked great.
    Last edited by smith43017; 09-07-11 at 11:05.

Posting Permissions

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