Torrwin
asked on
Create a pseudo-pivot query for a report
Hello,
I have table with widgets and a table with tasks. Each widget has one of each of the tasks, none get left out.
The tables look something like so:
tblWidget
Widget_ID INT
tblTask
Task_ID CHAR(5)
Task_Name VARCHAR(50)
tblWorkflow
Widget_ID INT
Task_ID CHAR(5)
Completion_Date DATETIME
Currently I can run a query on tblWorkflow and see my data like so:
Widget ID Task ID Completion_Date
1 1 1/1/13
1 2 1/2/13
2 1 3/1/13
2 2 3/2/13
...etc...
However, I'd like to create a query that pivots the data so all my task names are listed horizontally across the top and my widgets are listed vertically on the side like so:
Widget ID Task #1 Task #2 Task #3
1 1/1/13 1/2/13 1/3/13
2 3/1/13 3/2/13 3/3/13
...etc...
The results should dynamically pick up any new tasks as they are added so they don't need to be added manually.
Any thoughts?
Thanks in advance.
I have table with widgets and a table with tasks. Each widget has one of each of the tasks, none get left out.
The tables look something like so:
tblWidget
Widget_ID INT
tblTask
Task_ID CHAR(5)
Task_Name VARCHAR(50)
tblWorkflow
Widget_ID INT
Task_ID CHAR(5)
Completion_Date DATETIME
Currently I can run a query on tblWorkflow and see my data like so:
Widget ID Task ID Completion_Date
1 1 1/1/13
1 2 1/2/13
2 1 3/1/13
2 2 3/2/13
...etc...
However, I'd like to create a query that pivots the data so all my task names are listed horizontally across the top and my widgets are listed vertically on the side like so:
Widget ID Task #1 Task #2 Task #3
1 1/1/13 1/2/13 1/3/13
2 3/1/13 3/2/13 3/3/13
...etc...
The results should dynamically pick up any new tasks as they are added so they don't need to be added manually.
Any thoughts?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER