title: Trying to delete from multiple tables using SQL
body: <p>I have 4 tables in our application: </p>
  
  <ul>
  <li>User</li>
  <li>usession</li>
  <li>upklist</li>
  <li>projshare</li>
  </ul>
  
  <p>The last three tables contain a field called <code>session_id</code>.</p>
  
  <p>In the code below, the section in parenthesis works to get all <code>session_id</code> values from <code>usession</code> table for user "awpeople".</p>
  
  <p>The problem is how do I read this result set into an array and delete from all three tables where <code>session_id</code> is in the array results.</p>
  
  <p>Code:</p>
  
  <pre><code>DELETE FROM usession, 
              upklist, 
              projshar 
  WHERE  session_id = (SELECT session_id 
                       FROM   usession 
                       WHERE  delete_session_id IS NULL 
                              AND user_id = (SELECT user_id 
                                             FROM   users 
                                             WHERE  REGEXP_LIKE(USER_NAME, 
                                                    'awpeople', 'i'))); 
  </code></pre>