title: How to Delete Records NOT IN
body: <p>Hi I have the following SQL Query which gives me <strong>Scheme_Id</strong> which exist both in <strong>ProjectSchemes</strong> and <strong>Schemes</strong> table. I want to delete all records from <strong>Schemes</strong> table which have no record to <strong>ProjectSchemes</strong> table. How can I do so? Please help. I'm using MSSQL</p>
  
  <pre><code>select scheme_id from Schemes where Scheme_Id
  in(select s.Scheme_Id from Projects p 
  inner join ProjectSchemes ps on ps.Project_Id=p.Project_Id
  inner join Schemes s on s.Scheme_Id=ps.Scheme_Id)
  </code></pre>
  
  <p><strong>I'm trying to do the following but it's not working. Not working means no records affected but as I checked my Schemes table there are so many records that their scheme_id cannot be found on the ProjectSchemes table</strong> </p>
  
  <pre><code>delete from Schemes where Scheme_Id
  not in(select s.Scheme_Id from Projects p 
  inner join ProjectSchemes ps on ps.Project_Id=p.Project_Id 
  inner join Schemes s on s.Scheme_Id=ps.Scheme_Id)
  </code></pre>