title: Can I limit results using IN and COUNT?
body: <p>I need to limit the results from a query, but I can't implement any example I've seen using count and rownum. Given this table</p>
  
  <pre><code>rec error
  ___ _____
    1   123
    2   123
    3   456
    4   456
    5   456
    6   456
    7   456
    8   456
    9   456
   10   789
   11   789
   12   789
   13   789
  </code></pre>
  
  <p>This table has many more rows with many different error codes. I'm using this to get the records i need:</p>
  
  <pre><code>select rec, error from table where error in (123,456,789)
  </code></pre>
  
  <p>But say I want to only return no more than 2 records per error. I'm not sure how to do this. If I was only looking for a single error, I could simply use count or rownum. Not sure how to do it when using the IN condition.</p>