title: SQL: How to delete all rows from a table that are present in a View?
body: <p>The queries I would like to perform:</p>
  
  <pre><code>BEGIN TRANSACTION
  
     INSERT INTO TABLE_B SELECT * FROM TABLE_A WHERE SOME_COLUMN = 'something'
  
     DELETE FROM TABLE_A WHERE COLUMN IN (
       SELECT * FROM TABLE_A WHERE SOME_COLUMN = 'something'
     )
  
  
  END TRANSACTION
  </code></pre>
  
  <p>As you can see, there is a redundant <code>SELECT</code> statement in the <code>DELETE</code> query that I would like to replace (if possible), thus improving efficiency.</p>
  
  <p>I was thinking to create a View with the rows in the first query and then scan the View with the rows in the second table. If some condition matches, then delete the row from the second table.</p>
  
  <p>Could I get some pointers on how this could be done? If there is anything wrong I am doing, please critisize.</p>
  
  <p>I am using Sybase.</p>
  
  <p>Thanks.</p>