Guest User

Untitled

a guest
Apr 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.46 KB | None | 0 0
  1. /*
  2. DELETE t1 FROM `logs` t1, `logs` t2
  3.     WHERE t1.ip=t2.ip
  4.             AND t1.server=t2.server
  5.             AND t1.login=t2.login
  6.             AND t1.password=t2.password
  7.             AND t1.comment=t2.comment
  8.             AND t1.`id` < t2.`id`
  9. */
  10.  
  11.  
  12. create table tmp like logs;
  13.  
  14. alter table tmp add unique (`server`, `login`, `password`, `comment`);
  15.  
  16. insert into tmp select * from logs
  17.     on duplicate key update id = id;
  18.  
  19. rename table logs to deleteme, tmp to logs;
  20.  
  21. drop table deleteme;
Add Comment
Please, Sign In to add comment