title: php mysql display by views
body: <p>thanks for loking.</p>
  
  <p>i have 3 tables</p>
  
  <p><strong>books, book_category, book_click</strong>.</p>
  
  <p><strong>books table</strong>
  book_id,
  url,
  title,
  img,
  short_desc,
  featured,
  enable</p>
  
  <p><strong>book_category table</strong>
  book_id, category_id</p>
  
  <p><strong>book_clicks table</strong>
  site_id, time, views</p>
  
  <p>i like to get data from <strong>books</strong> table by view <strong>SUMS</strong> but this only returns one result</p>
  
  <pre><code>SELECT  books.book_id, url, title, short_desc, img, featured, SUM(views) as total_views
   FROM  books,book_category,book_click  WHERE  enable=1 AND category_id=7
  AND books.book_id=book_category.book_id
  ORDER BY  strong texttotal_views DESC
  </code></pre>