SELECT sum() FROM SELECT Equivalent

  1. Is it possible to sum multiple series in the same query using Flux without joining each table? I did use the following nested query in InfluxQL but cannot seem to work out how to do the same thing using Flux.

SELECT sum(“pos”) + sum(“len”) FROM (SELECT last(“position”) as “pos”, last(“length”) as “len” FROM “measurement” WHERE tag =~ /some_regex/

  1. Are more join types in the works/far away? I’d like to reduce my reliance on Kapacitor where possible.

Answering my own question for anyone else that runs into this,

I ended up using regex on the measurement, field and tag values and grouped by a common field to create a single table. Then piped this through to sum().

2 Likes