1

我有以下查询:

SELECT sum("field1" * "field2") FROM "my_db"."autogen"."data" GROUP BY time(1d) FILL(null)

简而言之,我想sum对两个字段的乘积fieldfield2.

上面的查询返回一个错误:expected field argument in sum()

这种事情在 InfluxDB 中完全可能吗?

4

1 回答 1

2

这是一个想法:尝试 Sub Query

注意:我现在没有编辑器,所以它也可能会出错

SELECT SUM(Multiplication) FROM 
    (SELECT  "field1" * "field2" as Multiplication, time(1d) as Days FROM 
        "my_db"."autogen"."data" GROUP BY time(1d) FILL(null)
    ) GROUP BY Days
于 2020-02-19T06:02:46.610 回答