title: How do I group by count of a field in InfluxDB?
body: <p>I have some data in InfluxDB that is connected events for certain TCP connections. So the measurement is connection_events with tags being: mac_address of connecting system, and some other metadata. The value is just connected=true|false</p>
  <p>What I want to do is something like this:</p>
  <pre><code>select count(mac_address), mac_address 
  from connection_events 
  where count(mac_address) &gt; X 
  group by mac_address
  </code></pre>
  <p>In other words, I want to see results like:</p>
  <blockquote>
  <p>28,ABCD</p>
  <p>14,EFGH</p>
  <p>3,XYZQ</p>
  </blockquote>
  <p>However, InfluxDB doesn't like this kind of query. I can't figure out how to parse through the dataset of connection events and aggregate them by mac address.</p>