title: Influxdb continuous query does not seem to save values
body: <p>I have configured Influxdb for my home assistant setup to record different sensor data. Some of the sensor data I'll store with continuous query for longer retention policy than 1 week. This has worked fine for most of my data such as temperature, humidity etc.</p>
  <p>However, I'd like to store the maximum light level of the day with continuous query. I crafted the following Influxdb sql query:</p>
  <pre><code>CREATE CONTINUOUS QUERY cq_1d_max_lightlevel ON homeassistant 
  BEGIN 
    SELECT daily_max AS value INTO homeassistant.year.lightlevel 
    FROM (SELECT max(value) AS daily_max 
      FROM homeassistant.autogen.lightlevel 
      GROUP BY time(1d), entity_id) 
    GROUP BY entity_id 
  END
  </code></pre>
  <p>If I run the select query manually in Influx explore view, the results look correct to me:
  <a href="https://i.stack.imgur.com/BTxHF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BTxHF.png" alt="enter image description here" /></a></p>
  <p>However after creating the continuous query, in the UI if I go to homeassistant.year.lightlevel, there is no &quot;value&quot; field visible like with other continuous queries I have: <a href="https://i.stack.imgur.com/QbD1X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QbD1X.png" alt="enter image description here" /></a></p>
  <p>If I query the homeassistant.year.lightlevel table, there is nothing in it even if I wait long enough that data should be populated into it. So is there something subtle but obvious I'm missing here as a new Influxdb user?</p>
  <p>EDIT: on second look I'm not completely sure why I used subquery in the original query. For now I crafted the following query to see if it works as expected:</p>
  <pre><code>CREATE CONTINUOUS QUERY cq_1d_max_lightlevel ON homeassistant 
  BEGIN 
    SELECT max(value) AS value INTO homeassistant.year.lightlevel 
    FROM homeassistant.autogen.lightlevel 
    GROUP BY time(1d), entity_id fill(previous) 
  END
  </code></pre>