title: Split string in cell and create multiple rows
body: <p>I've got an old database dropped in my knee and it's not very well modeled. The crappy modelling is taken care of in an overly complex software application, but I need to work more closely to the database.</p>
  
  <p>Instead of understanding how foreign keys and relations work, the database is modeled like this:</p>
  
  <ul>
  <li><code>Table1</code> contains <code>ID_1</code>, <code>Value</code></li>
  <li><code>Table2</code> contains <code>ID_2</code>, <code>AnotherValue</code>, <code>ID_1s</code></li>
  </ul>
  
  <p>where <code>ID_1</code> is an INT and <code>ID_1s</code> is a varchar containing a pipe-separated string of references to ID_1 (i.e. '1|4|5', meaning it is referenced to rows where table1.ID_1 is 1, 4, or 5)</p>
  
  <p>Now, I need to join these two tables rather than have an application parse through them and link them programatically. At the same time, I can't modify the db-model itself since it will break the application.</p>
  
  <p>Bsaically, I need to emulate a many-to-many relation with what I've got.</p>
  
  <p>Does anyone have an idea of a somewhat solid way of doing this?</p>
  
  <p>(In the future, there is a plan to basically redesign the database and use views as an abstraction for the application.)</p>