I now understand that my query is little bit more complicated.
I want to select data from a measurement then compare it with same measurement but where I have filtered out data that is between certain numbers.
data = all values
datafiltered = values between 10 and 100
SELECT "data" / "datafiltered" FROM
(
(
SELECT count("peak") AS "data" FROM "autogen"."CPU" WHERE ("host" =~ /^$Host$/) AND $timeFilter GROUP BY "Host"
)
,
(
SELECT count("peak") AS "datafiltered" FROM "autogen"."CPU" WHERE ("host" =~ /^$SHost$/) AND ("peak"< 100 OR "peak">10) AND $timeFilter GROUP BY "Host"
)
)
I tried something similar but it doesn’t allow me to SELECT FROM two subqueries.
My query looks like this
SELECT (("exA_spread"+"exB_spread")/2 )
AS "average"
FROM(
SELECT (("askPrice1" - "bidPrice1") * 200 / ("askPrice1" + "bidPrice1"))
AS "exA_spread"
FROM "three_month_data"."orderbook_exA"
WHERE("instrument" = 'exA:btc_usdt') AND $timeFilter
GROUP BY "instrument" fill(previous)
,
SELECT(("askPrice1" - "bidPrice1") * 200 / ("askPrice1" + "bidPrice1"))
AS "exB_spread"
FROM "three_month_data"."orderbook_exB"
WHERE( "instrument" = 'exB:btc_usdt') AND $timeFilter
GROUP BY "instrument" fill(previous)
)
The two subqueries works fine by themselves alone as a query, but when I try to perform join-measurement as above, it seems grafana won’t let me to SELECT FROM two subqueries.