I continue having an issue in having a continuous query executed. I have studied the documentation and tried to strip down my query to understand the bottom line of my issue. I have earlier posted a question with a more complex query but this post should contain the essence of the issue.
If I run from command line a query like this - with a condition “… WHERE … AND time > now()-1h” I get data as expected, as follows:
SELECT (mean - 5) AS Olari_sum INTO lamsum FROM (SELECT mean(temperature) FROM ruuvi_Olari WHERE “name” = ‘Olohuone’) WHERE mean > 5 AND time > now()-1h
select * from lamsum
However, when I replace the "time > time now()-1h with a Continuous query advanced syntax RESAMPLE EVERY 1h FOR 1h, it does not execute. There gets nothing saved in the series lamsum:
CREATE CONTINUOUS QUERY cq_lamsum ON Olari_saa RESAMPLE EVERY 1h FOR 1h BEGIN SELECT (mean - 5) AS Olari_sum INTO Olari_saa.kasvukausi.lamsum FROM (SELECT mean(temperature) FROM Olari_saa.kasvukausi.ruuvi_Olari WHERE “name” = ‘Olohuone’) WHERE mean > 5 END
Why it does not work ? To me, it looks a similar syntax to what has been presented in the documentation examples.