Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. SELECT DISTINCT(a1.actor)
  2. FROM actions a1
  3. JOIN actions a2 ON a1.ip = a2.ip
  4. WHERE a2.actor = 143
  5. AND a2.ip != '0.0.0.0'
  6. AND a2.ip != ''
  7. AND a2.actor != a1.actor
  8. AND a1.actor != 0
  9.  
  10. +----+-------------+-------+-------+------------------+---------+---------+------------------+------+--------------------------+
  11. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  12. +----+-------------+-------+-------+------------------+---------+---------+------------------+------+--------------------------+
  13. | 1 | SIMPLE | a2 | range | actor,ip,actorIp | actorIp | 66 | NULL | 3800 | Using where; Using index |
  14. | 1 | SIMPLE | a1 | ref | ip | ip | 62 | formabilio.a2.ip | 11 | Using where |
  15. +----+-------------+-------+-------+------------------+---------+---------+------------------+------+--------------------------+
  16.  
  17. SELECT DISTINCT(a1.actor)
  18. FROM actions a1
  19. INNER JOIN actions a2
  20. ON a1.ip = a2.ip AND
  21. a1.actor <> a2.actor
  22. WHERE a2.actor = 143
  23. AND a2.ip <> '0.0.0.0'
  24. AND a2.ip <> ''
  25. AND a1.actor <> 0
  26.  
  27. CREATE INDEX _actions_ip ON actions( ip );
  28. CREATE INDEX _actions_actor ON actions( actor );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement