title: Store multiple ID's in the same column?
body: <p>Is it possible to store an array of ID's within a table column which reference ID's from another table so that I can do a select query and determine whether a specific ID is within that column?</p>
  
  <p>Example scenario below.</p>
  
  <p>I have 3 tables like this:</p>
  
  <pre><code>Table: tab_groups with Columns: id, name
  Table: tab_users with Columns: id, name, groups
  Table: tab_forums with Columns: id, title, req_groups
  </code></pre>
  
  <p>A user can belong to multiple groups, the ID's of the groups that they belong to are stored in the <code>groups</code> column.</p>
  
  <p>A forum can have multiple required groups specified, which the ID's of are stored in <code>req_groups</code>. A user must belong to at least 1 group which matches with at least 1 required group in order to view the forum.</p>
  
  <p>How should I store the <code>groups</code> and <code>req_groups</code> columns so that I can later do a SELECT query to check whether a user belongs to a group which matches with a group ID required to view the forum?</p>
  
  <p>Also how would I update those columns to include new ID's or remove old ones?</p>
  
  <p>Currently I just have a pretty inefficient method which involves storing them as a string with a separator (like 1,2,3,4), then splitting them in PHP and doing a comparison check in a loop.</p>
  
  <p>For updating I just check whether a value exists, and add it onto the string.</p>