title: SQL Select then Delete
body: <p>I need to clean out some old data from my database tables. Below shows two tables, <strong>app_status</strong> and <strong>app_personal_details</strong>.</p>
  
  <p><img src="https://i.stack.imgur.com/BlqfP.png" alt="enter image description here"></p>
  
  <p>I have the following query to select all the records (applications) from the <strong>app_status</strong> table which have been created over 12 months from todays date</p>
  
  <pre><code>select status_id  
  from dbo.app_status  
  where submission_date &lt;= dateadd(month, -12, getdate()) order by 1
  </code></pre>
  
  <p>I then want to delete all the records from the <strong>app_personal_details</strong> table where the application_id exists in the list of retrieved status_id above.</p>
  
  <p>I hope this makes sense. I would like to know a quick way of deleting the data from both tables.</p>
  
  <p>Thanks for your help.</p>