taosdata / TDengine

High-performance, scalable time-series database designed for Industrial IoT (IIoT) scenarios
https://tdengine.com
GNU Affero General Public License v3.0
23.19k stars 4.84k forks source link

报 Window query not supported, since the result of subquery not include valid timestamp column 错误 #22816

Open evenson419 opened 12 months ago

evenson419 commented 12 months ago

查询语句如下: select _wstart ts, spread(dv) dv from (select ts, sum(ee00) dv from db_1036342996_lx.st_water_mqtt_lx_unit where pump_sn = 'S001' and ts >= '2023-09-01 00:00:00' and ts <= '2023-09-09 23:59:59' group by ts) INTERVAL(1d) fill(null);

evenson419 commented 12 months ago

是否是数据库目前还不支持这种用法?

tomchon commented 11 months ago

啥版本 @evenson419

zhaolihe commented 11 months ago

我也遇到这个问题了, server_version 是3.1.0.3, 有解决方案吗?

zhaolihe commented 11 months ago

这个问题我这边解决了,子查询(只查询明细,通过应用diff函数添加新列)中增加_ROWTS来作为时间戳列即可,使用_c0或真实存在的列名都不可以