title: Join two tables mysql, one to many relationship
body: <p>I have two tables:</p>
  
  <p>Points -></p>
  
  <pre><code>id           bigint(20)   NO   PRI  NULL   auto_increment
  created_at   datetime     NO        NULL   
  ip           varchar(255) NO        NULL   
  item_id      bigint(20)   NO   MUL  NULL   
  updated_at   timestamp    YES       NULL   
  </code></pre>
  
  <p>and Items -></p>
  
  <pre><code>id           bigint(20)    NO  PRI  NULL   auto_increment
  author       varchar(255)  NO       NULL   
  created_at   datetime      NO       NULL   
  description  varchar(255)  NO       NULL   
  link         varchar(255)  NO       NULL   
  source       varchar(255)  NO       NULL   
  title        varchar(180)  NO       NULL   
  url_encoded  varchar(255)  NO  UNI  NULL   
  updated_at   timestamp     YES      NULL   
  </code></pre>
  
  <p>I want to join them hopefully in one query so I will get <code>item.*</code> and the total of how many points are relative to them. I also want to do this only for the items that has any points created for them in the last 24 hours.</p>
  
  <p>This is my query so far:</p>
  
  <pre><code>SELECT `items`.*, COUNT(points.item_id) as points
  FROM `items`
  INNER JOIN `points` ON `items`.`id` = `points`.`item_id`
  WHERE `points`.`created_at` &gt; '2013-03-16 16:00:14'
  ORDER BY points DESC
  LIMIT 30;
  </code></pre>
  
  <p>Unfortunately it gives me only one row when it should be two with two points when it should be one. In my database there is two items and one point for each of them. Please help me fix this and understand how I can improve my query to get both the results.</p>