Summary: to replace concatenated values in one table with corrected values from another table and return the results to php to output
Details:
I have 2 mysql tables one contains category mapping relationships between a supplier and our store: Basically what we call their categories Please note that "~" denotes sub category level:
Category Mapping Relationship Table
Supplier Cat..........| Our Cat.....
dogs~leashes~long.....| pets~walking
dogs~leashes~long.....| pets~travel
dogs~leashes~short....| pets~walking
dogs~leashes~nylon....| pets~walking
dogs~feeding .........| pets~feeding
The second table contains supplier item ids with the categories that the supplier has the products in.
If the product resides in Multiple categories the categories are concatenated in the same field with a ','.Such as the following:
Supplier Item Table
Supplier item ID...| Supplier item Categories
28374 ............| dogs~leashes~long,dogs~leashes~nylon
My task is to replace the Supplier item Categories Path in the supplier table with our Path from our Category Mapping Relationship Table
So the result of the query/function Im trying to build for the above data modification would be the output of the column New item Category below:
Mysql result would be
Supplier item..| Supplier item Categories ..............| New item Categories
28374 ........| dogs~leashes~long,dogs~leashes~nylon ..|pets~travel,pets~walkin
g
PHP out put would be
28374 [TAB] pets~travel,pets~walking
28375 [TAB] whatevera,whateverb
28376 [TAB] whatevera,whateverb
Im not sure where to start and if anyone can even help me with psuedo code, that would be a great kick off for me. thanks in advance.
Im not sure how to handle the concatenated field and I would appreciate any help at all