How to split a row based on a delimiter into multiple rows and retain the ID and ordering by using a single SQL statement for MySQL
SQL is a real (but **DECLARATIVE**, not imperative) programming language! This has its pros and cons, see here.

But without the sarky comment from @RickJames :-), I was going to say the same thing. You'll always get problems like this when you don't properly normalise (you have what are called repeating groups - a breach of Codd's Rule no. 2 - scalar values). 

As @RickJames says, you'll have to programme your way out of this one using an imperative language, but NOT SQL.