Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need a query to pull 15 mins records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Need a query to pull 15 mins records
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Want to pull the job log into a Mainf... Jishu Mukherjee Compuware & Other Tools 9 Tue Mar 21, 2017 4:48 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us