title: How to join two tables using a comma-separated-list in the join field
body: <p>I have two tables, <code>categories</code> and <code>movies</code>.</p>
  
  <p>In <code>movies</code> table I have a column <code>categories</code>. That column consists of the categories that movie fits in. The categories are IDs separated by a comma.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>Table categories {
    -id-       -name-
    1          Action
    2          Comedy
    4          Drama
    5          Dance
  }
  
  Table movies {
    -id-       -categories-  (and some more columns ofc)
    1          2,4
    2          1,4
    4          3,5
  }
  </code></pre>
  
  <p>Now to the actual question: Is it possible to perform a query that excludes the categories column from the movies table, and instead selects the matching categories from the categories table and returns them in an array? Like a join, but the problem is there are multiple categories separated by comma, is it possible to do some kind of regex?</p>