INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

DB2 Advanced Query

DB2 Advanced Query

(OP)
Hi Programers,

Could you support me with a question that I could not solve?
Need to get the total time for each group, for example CREATE_TIMESTAMP column contains some time values ​​process. The ID column contains the classification of the process.

|_______ID______|_____MODEL______|_____________ CREATE_TIMESTAMP_________________
A A1 8/27/2013 12:57:05
A A1 8/29/2013 14:40:45
B B1 8/27/2013 7:04:49
B B1 8/27/2013 8:06:57
B B1 8/27/2013 9:06:57
B B1 8/27/2013 9:07:00
C C1 8/30/2013 1:28:36
C C1 8/30/2013 2:10:36
C C1 8/30/2013 2:13:40

I need to make a query to DB2 throws me the following information, based on the before table

|_______ID______|_____MODEL______|_____________TOTAL TIME_______________
A A1 2984:40
B B1 122:11
C C1 45:04


45:06 means---> 45 minutes, 6 seconds


Regards

RE: DB2 Advanced Query


hi,

CODE

select id, model, max(CREATE_TIMESTAMP)-min(CREATE_TIMESTAMP)
from .... 
is the basic query. the difference is the duration in DAYS.

It seems strange to report the results in minutes & seconds when there are DAYS & HOURS that can be displayed as HOURS:MIN:SEC otherwise report as minutes only.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close