CQ Advandced syntax issue

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
name: result
time written

1970-01-01T00:00:00Z 1
select * from lamsum
name: lamsum
time Olari_sum

2021-03-21T14:39:36.711676071Z 15.744139941690964

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.

manttila