×
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

Rollup to one record with same order number

Rollup to one record with same order number

Rollup to one record with same order number

(OP)
I have multiple rows with duplicate orders numbers and separate order types where as some are null and some are not. How can I roll these up into one record by order number and where there's null it will pick the corresponding value that is not null for the same order number? It can be two are more instances like this.

RE: Rollup to one record with same order number

(OP)
here's the example;

employeecode Monday Tuesday Wednesday Thursday Friday Saturday Sunday
502025 Rostered NULL NULL NULL NULL NULL NULL
502025 NULL Rostered NULL NULL NULL NULL NULL
502025 NULL NULL Rostered NULL NULL NULL NULL
502025 NULL NULL NULL Rostered NULL NULL NULL
502025 NULL NULL NULL NULL Rostered NULL NULL


I would like it just have one row and it just looks like this:

employeecode Monday Tuesday Wednesday Thursday Friday Saturday Sunday
502025 Rostered Rostered Rostered Rostered Rostered NULL NULL

 

RE: Rollup to one record with same order number

Would a grouping and a MAX be sufficient?

CODE

select [employeecode], Max([Monday]), Max([Tuesday]),Max([Wednesday]), Max([Thursday]), Max([Friday]), Max([Saturday]), Max([Sunday]) from <your_table> group by employeecode

(FYI: not really a DTS question, more a programming one - forum183)

soi là, soi carré

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