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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

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