Say I have time series data of the form
timestamp, <tag1, tag2>, value
I can do individual queries of the form
select mean(value) from db where tag1 = 'mytag' group by "tag2", time(5s)
This gives me avg of individual tag2 entries matching tag1 = mytag
Now I was to calculate the percentage distribution of above.
We can calculate the total (by removing grouping)
select mean(value) from db where tag1 = 'mytag' group by time(5s)
So theoretically I can calculate percentage by dividing query1 results by this query2 result.
How to combine these two queries in a single query statement?