Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. SELECT *
  2. FROM table1 t1
  3. WHERE EXISTS (select * from table1 t2 where t1.name = t2.name and t2.id is null)
  4. ORDER BYy Id, Name
  5.  
  6. SELECT t1.*
  7. FROM table1 t1
  8. INNER JOIN
  9. ( SELECT [Name]
  10. FROM table1
  11. GROUP BY t1. [Name]
  12. HAVING COUNT(*) >1 ) t2 ON t1.Name = t2.Name
  13. ORDER BY t1.Customer, t1.Name
  14.  
  15. DELETE
  16. FROM table1
  17. Where Name in ('name1', 'name2'.......)
  18. and id3 is not NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement