I have two tables:
________________________ ________________________________
| id | categoryName | | product | categories |
------------------------ --------------------------------
| 1 | clothes | | coat | clothes,outdoor |
| 2 | indoor | | slippers | clothes,indoor |
| 3 | PPE | | umbrella | outdoor,ppe |
| 4 | outdoor | | | |
------------------------ --------------------------------
I need to replace the values in the categories field in the second table for the category IDs in the first table so the tables would end up looking like this:
________________________ ________________________________
| id | categoryName | | product | categories |
------------------------ --------------------------------
| 1 | clothes | | coat | 1,4 |
| 2 | indoor | | slippers | 1,2 |
| 3 | PPE | | umbrella | 4,3 |
| 4 | outdoor | | | |
------------------------ --------------------------------
Since I have so many to update I am trying to work out how to do it programatically, but am struggling with it.