title: What is wrong with this SQL DELETE FROM syntax?
body: <p>I'm trying to delete 96k records.  </p>
  
  <h1>delete all the records in table xoops_bb_posts_text pages that don't have a have a matching post_id to xoops_bb_posts</h1>
  
  <p>This query worked returning 91k records:  </p>
  
  <pre><code>SELECT *  
     FROM xoops_bb_posts_text t  
     WHERE not exists (
         select post_id 
             from xoops_bb_posts p 
             WHERE p.post_id = t.post_id 
     );  
  </code></pre>
  
  <p>when I tried to delete those records I got a syntax error, but I don't see it. </p>
  
  <pre><code>DELETE FROM xoops_bb_posts_text t  
  WHERE not exists (
      select post_id 
         from xoops_bb_posts p 
      WHERE p.post_id = t.post_id 
  );  
  </code></pre>
  
  <p>Where is the error?  </p>
  
  <p>Error  </p>
  
  <p>SQL query: Documentation  </p>
  
  <pre><code>DELETE FROM xoops_bb_posts_text t 
     WHERE NOT EXISTS (  
        SELECT post_id  
           FROM xoops_bb_posts p  
           WHERE p.post_id = t.post_id  
  )  
  </code></pre>
  
  <p>MySQL said: Documentation  </p>
  
  <blockquote>
    <p>#1064 - You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near 'WHERE not exists (select post_id from xoops_bb_posts p WHERE
    p.post_id = t.post_' at line 2</p>
  </blockquote>