Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts How to force a select query to abend neo4u DB2 7 Mon Apr 23, 2018 1:36 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us