IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need a query to pull 15 mins records


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Tue Mar 17, 2015 5:34 pm
Reply with quote

Code:

A_datetime              A_name
2015031700:00:00    Shanth
2015031700:15:00    Sundar
2015031700:16:00    Madhu
2015031700:30:00    Kishore


Result should be for each 15 mins count

Code:

Count 00:00 to 00:15     2
Count 00:16 to 00:30     2
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Mar 19, 2015 8:40 pm
Reply with quote

Code:
select
    date(My_timestamp)
   ,time('00.00.00') + (midnight_seconds(My_timestamp) / 900 * 900) seconds
   ,time('00.00.00') + (midnight_seconds(My_timestamp) / 900 * 900 + 899) seconds
   , count(*)
  from My_table
 group by
    date(My_timestamp)
   ,time('00.00.00') + (midnight_seconds(My_timestamp) / 900 * 900) seconds
   ,time('00.00.00') + (midnight_seconds(My_timestamp) / 900 * 900 + 899) seconds
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top