title: MySQL count group by
body: <p>I have 3 tables, orders(orders_id, date, ...), products (product_id, product_name, product_price) and order_products (product_id, orders_id, product_id, products_quantity) and I need to group the products so that they are displayed by product and total quantity per product to make it easier for the eshop manager to know how many items per product have been ordered.</p>
  
  <p>I'm having a little bot of trouble thinking of the correct sql syntax, I keep bumping into group by issues and i'd like some help.</p>
  
  <p>This is what I've done so far</p>
  
  <pre><code>select *, op.products_quantity as pquant, count(*) as `count`
  from orders o
  left join orders_products op on o.orders_id = op.orders_id
  left join products p on op.products_id = p.products_id 
  group by op.orders_products_id
  order by op.products_id desc;
  </code></pre>