title: Count of sub-select in influxdb not returning anything
body: <p>I've got some data structured as such</p>
  
  <p><code>select * from rules where time &gt; now() - 1m limit 5</code></p>
  
  <pre><code>name: rules
  time                ackrate consumers deliverrate hostname    publishrate ready redeliverrate shard unacked version
  ----                ------- --------- ----------- --------    ----------- ----- ------------- ----- ------- -------
  1513012628943000000 864     350       861.6       se-rabbit14 975.8       0     0             14    66      5
  1513012628943000000 864.8   350       863         se-rabbit9  920.8       0     0             09    64      5
  1513012628943000000 859.8   350       860.2       se-rabbit8  964.2       0     0             08    58      5
  1513012628943000000 864.8   350       863.6       se-rabbit16 965.4       0     0             16    64      5
  1513012631388000000 859.8   350       860.2       se-rabbit8  964.2       0     0             08    58      5
  </code></pre>
  
  <p>I want to calculate the percentage of 'up-time' defined as the amount of time when the queue has no ready messages.</p>
  
  <p>I can get the maximum number of ready in each minute</p>
  
  <p><code>select max(ready) from rules where time &gt; now() - 1h group by time(1m) limit 5</code></p>
  
  <pre><code>name: rules
  time                max
  ----                ---
  1513009560000000000 0
  1513009620000000000 0
  1513009680000000000 0
  1513009740000000000 0
  1513009800000000000 0
  </code></pre>
  
  <p>Using a sub-query, I can select only the minutes that have values ready.</p>
  
  <p><code>select ready from (select max(ready) as ready from rules where time &gt; now() - 1h group by time(1m)) where ready &gt; 0</code></p>
  
  <pre><code>name: rules
  time                ready
  ----                -----
  1513010520000000000 49
  1513013280000000000 57
  </code></pre>
  
  <p>I wanted to get a count of these values and then doing a bit of math calculate a percentage. In this case, with 2 results in the last hour, </p>
  
  <p>((60 minutes * 1 hour) - 2) / (60 minutes * 1 hour)) == 96%</p>
  
  <p>When I try to count this though, I get no response. </p>
  
  <p><code>select count(ready) from (select max(ready) as ready from rules where time &gt; now() - 1h group by time(1m)) where ready &gt; 0</code></p>
  
  <p>This is v1.2.2.</p>
  
  <p>How can I return a count of the number of results?</p>