sebo: mehr als x mal

Beitrag lesen

  
mysql> EXPLAIN SELECT a.id, a.name, COUNT(b.id) AS count_files FROM users a INNER JOIN fotos b ON a.id = b.user_id GROUP BY a.id, a.name HAVING COUNT(b.id) > 5;  
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+  
| id | select_type | table | type | possible_keys | key        | key_len | ref        | rows  | Extra                           |  
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+  
|  1 | SIMPLE      | a     | ALL  | PRIMARY       | NULL       |    NULL | NULL       | 432221 | Using temporary; Using filesort |  
|  1 | SIMPLE      | b     | ref  | usernummer    | usernummer |       3 | users.a.id |     2 |                                 |  
+----+-------------+-------+------+---------------+------------+---------+------------+-------+---------------------------------+  
2 rows in set (0.00 sec)  
  

ah sorry, hatte die original-tabelle versehendlich verwendet!