'How can I solve this TDengine sql problem?

I was trying to output a desired result of my data by using TDengine, sql is:

select * from taos_dn_disk_total where ts >= NOW-1d and ts <= NOW interval(10m) fill(prev);

And the result occurs:

DB error: invalid operation: functions not compatible with interval (0.000562s)

TDengine's official documentation notes that they support both interval operation and fill operation, but why the result shows 'not compatible'?



Solution 1:[1]

From official document

In a scenario of IoT, it is often necessary to aggregate the collected data by intervals through down sampling. TDengine provides a simple keyword interval, which makes query operations according to time windows extremely simple.

So interval can only use with aggregate function, you might want to change the SQL to something like: select max(*) from taos_dn_disk_total where ts >= NOW-1d and ts <= NOW interval(10m) fill(prev);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zhaoyanggh