Hello all. I am trying to figure out how to write SQL to group data by common values together after they've been identified and assembled together. Using the following sample data,
DATA
ORDERS TABLE
ID 100
ORDER DETAIL TABLE
ID 200
Orders_ ID 100
Part_ID 500
PART TABLE
ID 500
ID 501
ID 502
STANDARDS TABLE
ID 700
Part_ID 500
Standard A
ID 701
Part_ID 500
Standard B
ID 702
Part_ID 500
Standard C
ID 703
Part_ID 501
Standard D
ID 704
Part_ID 501
Standard E
ID 705
Part_ID 501
Standard F
ID 706
Part_ID 502
Standard A
ID 707
Part_ID 502
Standard B
ID 708
Part_ID 502
Standard C
I want to generate the following query output:
Order ID 100
Standard A,B,C
Part_ID 500
Part ID 502
Standard D,E,F
Part_ID 501
Any suggestions on the code to use?
DATA
ORDERS TABLE
ID 100
ORDER DETAIL TABLE
ID 200
Orders_ ID 100
Part_ID 500
PART TABLE
ID 500
ID 501
ID 502
STANDARDS TABLE
ID 700
Part_ID 500
Standard A
ID 701
Part_ID 500
Standard B
ID 702
Part_ID 500
Standard C
ID 703
Part_ID 501
Standard D
ID 704
Part_ID 501
Standard E
ID 705
Part_ID 501
Standard F
ID 706
Part_ID 502
Standard A
ID 707
Part_ID 502
Standard B
ID 708
Part_ID 502
Standard C
I want to generate the following query output:
Order ID 100
Standard A,B,C
Part_ID 500
Part ID 502
Standard D,E,F
Part_ID 501
Any suggestions on the code to use?