【问题标题】:Subtract two count values with different where clause in influxDb在 influxDb 中用不同的 where 子句减去两个计数值
【发布时间】:2019-12-09 06:31:26
【问题描述】:

我在 influxDb 中使用两个键进行测量:operationcountoperation 键可以存储两个不同的值:“添加”和“删除”。

我想将 operation='delete' 时的 sum(count) 值减去 operation='add' 时的 sum(count) 值。

mysql 支持以下查询,但在 influxql 中会抛出错误:

select (select sum(count) from measurement where operation='add') - (select sum(count) from measurement where operation='delete');

如何使用单个 influxql 查询来完成?我不认为 influxql 在这种情况下允许两个不同的 where 子句。

【问题讨论】:

  • influxDb版本为1.7

标签: influxdb influxql


【解决方案1】:

InfluxQL 不支持这种多查询数学。您需要在应用级别进行计算。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-29
    • 2013-10-03
    • 2014-12-22
    • 2021-03-28
    • 1970-01-01
    • 2021-10-14
    • 2020-11-27
    • 1970-01-01
    相关资源
    最近更新 更多