×
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!
  • Students Click Here

*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.

Students Click Here

Jobs

For the 9/80 Work Week, Need to Add Hours from PM of First Friday To Next Friday...

For the 9/80 Work Week, Need to Add Hours from PM of First Friday To Next Friday...

For the 9/80 Work Week, Need to Add Hours from PM of First Friday To Next Friday...

(OP)
Hi Everyone,

I have something like the following...

Date ........ Hours ........ 980X
03/08/13 ........ 4 ........ 98
03/08/13 ........ 2 ........ AM
03/08/13 ........ 2 ........ NULL
03/08/13 ........ 3 ........ PM
03/15/13 ........ 2 ........ 98
03/15/13 ........ 3 ........ AM
03/15/13 ........ 2 ........ NULL

I will have a set for each date in the week; however, for simplicity, I just included Friday as that is the one I am having trouble with.

The problem I am having is that I need to sum all the totals for the week and calculate overtime, if it exists. So, on the first week, you can see the various values. If the value is 98, Am, or null, it is summed for the current week. However, if it is PM, it is added to the following week instead.

Any help with this would be great.

Thanks and let me know if you need any other information.

Neal

RE: For the 9/80 Work Week, Need to Add Hours from PM of First Friday To Next Friday...

Well, here's one way:

CODE

SELECT CASE WHEN (NVL(x980,'AM') IN ('AM','98')) THEN theDate
            ELSE theDate + 7 END AS weekDate, SUM(hours) AS theTime
FROM mytable
GROUP BY  CASE WHEN (NVL(x980,'AM') IN ('AM','98')) THEN theDate
               ELSE theDate + 7 END; 

RE: For the 9/80 Work Week, Need to Add Hours from PM of First Friday To Next Friday...

(OP)
I will give it a try.

Thanks.

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! Already a Member? Login

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