troubleshooting Question

Need Help With SQL Script for "Pivot Table"

Avatar of cbridgman
cbridgmanFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2008
7 Comments1 Solution270 ViewsLast Modified:
I'm using SQL Server 2008.

We have a table called WOSTATUS (Work Order Status). Each row in the table shows the date and time that a Work Order "moved" from one status to the next. For example, a work order might be awaiting approval (WAPPR) and then a few days later get approved (APPR). Each row also contains the identity of the work order that changed (Work Order #) and the status code that it changed to.

Using the WOSTATUS table as the base, I want to run a script that will show me the same work orders that are in the WOSTATUS table, the date and time that they got a WAPPR status, the date and time that the received an APPR status, and the elapsed time between the two.

I want to run another script that will show me the same work orders that are in the WOSTATUS table, the date and time that they got a WAPPR status, the date and time that the received an COMP status, and the elapsed time between the two.

I've attached a word document that shows and example.

Can anyone help with the SQL that I'd need to develop?

Thanks.
ASKER CERTIFIED SOLUTION
prequel_server

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros