I have been given a mySQL database to restructure into an OpenCart installation.
I've pulled most of the data across but in the old site "product categories" have been all put in a single column
|228|243|228|239|228|
or
|88|
or
|88|243|
So I have no idea how many would be in any particular record.
I don't want to use a php function to extract this, as I am manually extracting the data with SQL queries into the new database.
An added complication is I have to create a new line in the products_to_categories
for each value in the column - I don't mind a multiple step process, I'm not expecting to do this with a single query - I am looking to avoid re-entering all the data.
I know this is similar to MySQL Split String but I don't feel it's a duplicate as that does not answer my question fully as there may be any number of values in the column - not just 2.
[EDIT] I tried common_schema, but at my current level of skill I found it difficult to get the result I was seeking, but I will certainly use it in future. For the record this is closest to my my solution - Can you split/explode a field in a MySQL query?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…