Guest User

Untitled

a guest
May 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. delete from table1
  2. where (col1, col2) in (
  3. select col1,col2
  4. from table2
  5. )
  6.  
  7. with tempTable(col1,col2) as (
  8. select col1,col2
  9. from table2
  10. )
  11. delete from table1
  12. where table1.col1 = tempTable.col1
  13. and table1.col2 = tempTable.col2
  14.  
  15. DELETE Table1
  16. from Table1 t1
  17. inner join tempTable t2
  18. on t2.Col1 = t1.Col1
  19. and t2.Col2 = t1.Col2
  20.  
  21. delete from table1 t1 where exists
  22. (
  23.  
  24. select 1 from table2 t2 where t1.col1 = t2.col1 and t1.col2 > t2.col2
  25.  
  26. )
  27.  
  28. SELECT t1.*
  29. FROM [Table1] t1
  30. INNER JOIN [Table2] t2 ON t1.[col1] = t2.[col1] AND t1.[Col2]=t2.[Col2]
  31.  
  32. DELETE t1
  33. FROM [Table1] t1
  34. INNER JOIN [Table2] t2 ON t1.[col1] = t2.[col1] AND t1.[Col
Add Comment
Please, Sign In to add comment