title: Delete rows from a table with not in ( another table )
body: <p>I have two tables A and B, in the B there is a foreign key from A, what I want to do is to delete all the rows from A that they don't have an occurrence in B, I execute the following query but it's not working :</p>
  
  <pre><code>DELETE from A 
  WHERE  id_A
         not in (select DISTINCT(foreign_key_of_A_in_B) from B)
  </code></pre>
  
  <p>Any idea ?</p>