This may take a bit of explaining!

 

I have a incoming table structure of 

 

PartRef     Attrib            Value

ABC001        1               10.00

ABC001        2               4

ABC001        3               A

ABC002        1               12.00

ABC002        2               6

ABC002        3               B

Etc

Where Attrib 1 represents Length 

Attrib 2 represents Set Qty and Attrib 3 represents Head Shape

 

My Query of 

 

SELECT 

PartRef

GROUP_CONCAT(IF(attr_id=1, value,null)) AS Length,

GROUP_CONCAT(IF(attr_id=1, value,null)) AS SetQty,

GROUP_CONCAT(IF(attr_id=1, value,null)) AS HeadShape

>From myTable

GROUP BY part_ref

 

Gives me 

 

PartNo      SetQty      Length      HeadShape

ABC001        4           10.00        A

ABC002        6           12.00        B

 

Which is fine for part ref with only ONE entry...  however....

The data CAN come with multiple entries for each PartRef which now gives
me,

Correctly

 

PartNo      SetQty      Length            HeadShape

ABC001        4,5     10.00,12.00          A,B

ABC002        6        12.00                B

 

What I now need to do is to SPLIT out the doubled up fields and end up
with ..

 

PartNo      SetQty      Length            HeadShape

ABC001        4       10.00                A

ABC001        5       12.00                B

ABC002        6        12.00                B

 

Any pointers would be gratefully received

 

Roger

 

 

 

Reply via email to