在 InfluxDB 中添加否定条件:AND NOT (meter_id='500' AND conso_prod='Prod')

Add negative condition in InfluxDB: AND NOT (meter_id='500' AND conso_prod='Prod')

我在 Influx 1.7 中有这个查询

SELECT sum(delta) from measures  
WHERE operation_id='A1' 
AND time>'2020-05-19T22:00:00.000Z' AND time<'2020-05-26T22:00:00.000Z'  GROUP BY time(1d)

我想排除(meter_id='500' AND conso_prod='Prod')

时的结果

所以,我尝试添加:

AND NOT (meter_id='500' AND conso_prod='Prod')

但似乎 NOT 不受 influx 支持。

所以,我试着写否定,但好像XOR也不存在。

这看起来很容易,但我做不到。知道我该怎么做吗?

更新您的 Where 子句如下:

SELECT sum(delta) from measures  
WHERE operation_id='A1' 
AND time>'2020-05-19T22:00:00.000Z' AND time<'2020-05-26T22:00:00.000Z'  

AND ( (meter_id='500' AND conso_prod!='Prod') OR (meter_id!='500' AND conso_prod='Prod') )

GROUP BY time(1d)