claudermilk
Technical User
I'm stuck for ideas on how to solve a somewhat complex reporting problem. I have two tables which I'm trying to join; the complex part is the second table I need to join several times. The data looks like this:
Table1
ParentPart
Component
QtyPer
Table2
FormType
KeyField
FieldName
AlphaValue
In table 2 I'm filtering the FormType for appropriate entries. I need to relate KeyField to Component for each of four different values found in FieldName to give me AlphaValue. To complicate things I may get from one to four hits on FieldName for each Component-KeyField pairing. The end record I'm trying to get should be like:
ParentPart, Component, QtyPer, AlphaValue(1), AlphaValue(2), AlphaValue(3), AlphaValue(4)
I've tried subqueries and self-joins and cannot seem to find a way to accomplish this. I can easily get the first table query set up, and I've even gotten Table2 to produce the four fields like I'd like to see, but I cannot for the life of me get the two parts into a single result.
Any help would be appreciated.
Table1
ParentPart
Component
QtyPer
Table2
FormType
KeyField
FieldName
AlphaValue
In table 2 I'm filtering the FormType for appropriate entries. I need to relate KeyField to Component for each of four different values found in FieldName to give me AlphaValue. To complicate things I may get from one to four hits on FieldName for each Component-KeyField pairing. The end record I'm trying to get should be like:
ParentPart, Component, QtyPer, AlphaValue(1), AlphaValue(2), AlphaValue(3), AlphaValue(4)
I've tried subqueries and self-joins and cannot seem to find a way to accomplish this. I can easily get the first table query set up, and I've even gotten Table2 to produce the four fields like I'd like to see, but I cannot for the life of me get the two parts into a single result.
Any help would be appreciated.