How to subtract values from different queries

#1

Hello,
I would need to subtract value from different queries but I cannot figure how how to do.
In fact any attempt done got an error 400.

Here are the queries:

A) select sum(wh)/1000 from (select mean_value /60  as wh from (SELECT mean(*)  FROM "power"."autogen"."generale_w" WHERE time > now()-24h GROUP BY time(1m) fill(none)))

B) select sum(wh)/1000 from (select mean_value /60  as wh from (SELECT mean(*)  FROM "power"."autogen"."lavatrice" WHERE time > now()-24h GROUP BY time(1m) fill(none)))
C) select sum(wh)/1000 from (select mean_value /60  as wh from (SELECT mean(*)  FROM "power"."autogen"."forno" WHERE time > now()-24h GROUP BY time(1m) fill(none)))
D) select sum(wh)/1000 from (select mean_value /60  as wh from (SELECT mean(*)  FROM "power"."autogen"."lavastoviglie" WHERE time > now()-24h GROUP BY time(1m) fill(none)))
E) select sum(wh)/1000 from (select mean_value /60  as wh from (SELECT mean(*)  FROM "power"."autogen"."frigorifero" WHERE time > now()-24h GROUP BY time(1m) fill(none)))

I would need to got a value from:

A - (B+C+D+E)

Could You hep me please?

Thank You

Regards

#2

Hey @mauog, this unfortunately is a limitation of the current v1.x branch of influxdb, but is something that a lot of people have been asking about:

http://docs.influxdata.com/influxdb/v1.7/troubleshooting/frequently-asked-questions/#how-do-i-query-data-across-measurements

If you’re up for using the v2.0-alpha as a test, you can do this now! Check out this amazing post about doing just that:

https://www.influxdata.com/blog/influxdb-how-to-do-joins-math-across-measurements/

#3

Thanks @sebito91,
as far as you know is there any workaround maybe using any other programs?