title: Mysql Query count
body: <p>I wnat all the records in table belonging to a set and where a particular friend_id doesn't exist not more than twice </p>
  
  <p>something like this</p>
  
  <pre><code>SELECT * FROM `friends` WHERE count(`friend_id`) &lt; 2 and friend_id in (1,2,3,4)
  </code></pre>