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 Joining 2 records to 1 using Sort cmuncan DFSORT/ICETOOL 1 Sat Dec 08, 2018 8:53 am
This topic is locked: you cannot edit posts or make replies. DFSORT output in CSV for data spans i... hiravibk DFSORT/ICETOOL 3 Tue Nov 13, 2018 7:55 pm
No new posts Writing multiple records into a CSV r... hiravibk DFSORT/ICETOOL 2 Wed Nov 07, 2018 2:35 pm
No new posts Query on secondary index Suja.Sai IMS DB/DC 1 Wed Oct 31, 2018 9:47 pm
No new posts Can records in IMS/DB be related usin... SRICOBSAS IMS DB/DC 2 Fri Oct 19, 2018 3:53 pm

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