×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

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

 Forum Search FAQs Links MVPs

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

#### 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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!