title: MySQL having if
body: <p>I'm having trouble with a MySQL query. If the label is "5" then I only want records where there is more than 10 of them for the current day, but any number of rows for other labels. What is the best way to accomplish this in the query?</p>
  
  <pre><code>SELECT id,name,label,date
  FROM items
  GROUP BY DATE('date'), label
  HAVING COUNT(id) &gt; 10 IF label = 5
  </code></pre>