title: How do I use SQL to select rows that have > 50 related rows in another table?
body: <p>I've been trying to find out how to write this query in sql.  </p>
  
  <p>What I need is to find the productnames (in the products table) that have 50 or more orders (which are in the order table).  </p>
  
  <p>only one orderid is matched up to a productname at a time so when I try to count the orderid's it counts all of them.  </p>
  
  <p>I can get distinct productnames but once i add in the orderid's then it goes back to having multiple productnames. </p>
  
  <p>I also need to count the number of customers (in the order table) that have ordered those products. </p>
  
  <p>I need some serious help ASAP!  if anyone could help me figure out how to figure this out that would be awesome!</p>
  
  <pre><code>Table: Products
        `productname` in the form of a text like 'GrannySmith'
  
  Table: Orders
        `orderid` in the form of '10222'..etc
        `custid` in the form of something like 'SMITH'
  </code></pre>