If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQL Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-07-11, 09:23
smith43017 smith43017 is offline
Registered User
 
Join Date: Sep 2006
Posts: 92
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
Reply With Quote
  #2 (permalink)  
Old 09-07-11, 09:31
smith43017 smith43017 is offline
Registered User
 
Join Date: Sep 2006
Posts: 92
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
Reply With Quote
  #3 (permalink)  
Old 09-07-11, 09:35
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #4 (permalink)  
Old 09-07-11, 09:54
smith43017 smith43017 is offline
Registered User
 
Join Date: Sep 2006
Posts: 92
thank you so much przytula for your help.

It worked great.

Last edited by smith43017; 09-07-11 at 10:05.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On