I'm looking around for examples or suggestions of how to go about my problem.
I have three tables (work, engineers, parts) that are joined by a column wo_number.
When I do my query in sql:
It returns the correct layout for the number of engineers that worked on this particular call example
Work Number Name
----------------
1 Joe
1 Jane
But my problem is when I add the parts that was used on the call
it returns the correct number of parts but in this format:
Work Number Name Part
----------------------
1 Joe Part1
1 Jane Part1
1 Joe Part2
1 Jane Part2
1 Joe Part3
1 Jane Part3
etc.
As you can see this is very ugly stepping through to see how many distinct engineers and distinct parts are used on the call.
I checked the sql forums and they all pretty much said to write an application to produce an output such as
Work Number Engineer Part
-----------------------------
1 Joe Part 1 Part 2 Part 3 Part 4
2 Jane Part 5 Part 6 Part 7 Part 8
I'm asking how do I go about to writing a program that will help me produce an output similiar to this. Any tips or suggestions be greatly appreciated.
I have three tables (work, engineers, parts) that are joined by a column wo_number.
When I do my query in sql:
Code:
select work.wo_number, engineer.name from work join engineers on work.wo_number = engineer.wo_number
Work Number Name
----------------
1 Joe
1 Jane
But my problem is when I add the parts that was used on the call
Code:
select work.wo_number, engineer.name, parts.part_number from work join engineers on work.wo_number = engineer.wo_number join parts on work.wo_number = parts.wo_number
Work Number Name Part
----------------------
1 Joe Part1
1 Jane Part1
1 Joe Part2
1 Jane Part2
1 Joe Part3
1 Jane Part3
etc.
As you can see this is very ugly stepping through to see how many distinct engineers and distinct parts are used on the call.
I checked the sql forums and they all pretty much said to write an application to produce an output such as
Work Number Engineer Part
-----------------------------
1 Joe Part 1 Part 2 Part 3 Part 4
2 Jane Part 5 Part 6 Part 7 Part 8
I'm asking how do I go about to writing a program that will help me produce an output similiar to this. Any tips or suggestions be greatly appreciated.