Hello, I’m trying to obtain a new field that is the subtraction of two fields in two different tables. Tha syntax below is ok but gives no result, whereas the single queries get the right result.
Any suggestion what is wrong?
Many thanks
SELECT (non_negative_derivative(mean(“POWERPANNELLI”), 120s )- non_negative_derivative(mean(“POWERCASA”), 120s ))
AS “Consumo”
FROM (
SELECT mean(“ENERGY_Power”) AS “POWERCASA” FROM “telegraf”.“autogen”.“CASA” WHERE time > :dashboardTime: AND time < :upperDashboardTime: GROUP BY time(1m)
), (
SELECT mean(“ENERGY_Power”) AS “POWERPANNELLI” FROM “telegraf”.“autogen”.“Pannelli” WHERE time > :dashboardTime: AND time < :upperDashboardTime: GROUP BY time(1m)
)
GROUP BY time(1m) fill(null)