admin管理员组文章数量:1401778
I am working with GridDB and trying to run a TQL (TimeSeries Query Language) query on a TimeSeries container. However, I keep encountering a syntax error.
I have a TimeSeries container named sensor_data, which has the following schema:
Column Name Data Type timestamp TIMESTAMP temperature DOUBLE humidity DOUBLE
I want to retrieve sensor readings where the temperature is above 30 degrees for the last 24 hours. Here's my TQL query:
SELECT Avg(temperature) FROM sensor_data
WHERE timestamp > TIMESTAMPADD(HOUR, -24, NOW())
AND temperature > 30;
SELECT Avg(humidity) FROM sensor_data
WHERE timestamp > TIMESTAMPADD(HOUR, -24, NOW())
AND temperature > 30;
However, when I execute this query, I get the following error:
Syntax error near 'timestamp' at line 2Syntax error near 'timestamp' at line 2Syntax error near 'timestamp' at line 2
What I've Tried: Changing TIMESTAMPADD(HOUR, -24, NOW()) to NOW() - INTERVAL 24 HOUR (but GridDB does not support INTERVAL).
Using TO_TIMESTAMP around NOW() but still get errors.
Expected Output: A filtered result with Average value where temperature/humidity values are greater than 30 (or given value) and timestamps are within the last 24 hours.
Actual Output: A syntax error on the timestamp column.
Question: Does GridDB require a different way to filter timestamps in a TimeSeries container?
How can I properly filter results based on timestamps in the last 24 hours?
Any guidance would be greatly appreciated!
本文标签: GridDB TQL Query Fails with quotSyntax Errorquot on TimeSeries ContainerStack Overflow
版权声明:本文标题:GridDB TQL Query Fails with "Syntax Error" on TimeSeries Container - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744280535a2598629.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论