Advertisement
the0938

Vodokanal: Find relations for duplicates

Mar 19th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.45 KB | None | 0 0
  1. select count(*) as has_relations
  2. -- здесь нужно заменить user_object на свою таблицу.
  3. from user_object as tbl
  4. where exists (
  5.   select null
  6.   from (select id, username, count(username) as count from j25_users group by username) as sub
  7.   where sub.count > 1
  8.   -- а здесь, если нужно, заменить название поля с ссылкой на id пользователя.
  9.   and tbl.UserID = sub.id
  10. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement