Hi! I have a tag with 500 distinct values. I would like to plot (in Grafana) the course of the top 5 tags, where top is based on the last measurement. I already figured that I can query my top tags based on the last value like this:
select top(value, 3), tld from (select last(value) as value, tld from tld_counter group by tld)
This results in:
time top tld
---- --- ---
1494633600000000000 120412 com
1494633600000000000 14924 uk
1494633600000000000 14311 nl
But how do I query the datapoints from last week for these top tags in a single query (so Grafana can show it) ?
Something like:
select tld, value from tld_counter where tld in (
select top(value, 3), tld from (select last(value) as value, tld from test_tld_counter group by tld)
)