Influx version 1.8.10
I have a slightly complicated query that groups by 4 different Tags, and then takes the last result from the grouping. For example, this query does exactly what I want - it returns the very last entry for the grouping if the grouping has failed.
select Test, Type, State, Result, Run, Error, ErrorStep, Info from (SELECT * from results where ENV='UAT' GROUP BY Test, Type, State, ENV ORDER BY time DESC limit 1) Where Result='Failed' GROUP BY Test, Type, State, ENV ORDER BY time DESC
However, what I cant figure out is how to get the Count of the Rows of this Grouping -
select count(Code) from (SELECT * from results where ENV='UAT' GROUP BY Test, Type, State, ENV ORDER BY time DESC limit 1) Where Result='Failed' GROUP BY Test, Type, State, ENV ORDER BY time DESC
And when I try to take the sum of the rows with something like this -
select sum(count) from (select count(Code) from (SELECT * from results where ENV='UAT' GROUP BY Test, Type, State, ENV ORDER BY time DESC limit 1) Where Result='Failed' GROUP BY Test, Type, State, ENV ORDER BY time DESC) GROUP BY count ORDER BY time DESC
I end up with 14 somehow -
So my question is, how can I get the row count of the original query? -
select Test, Type, State, Result, Run, Error, ErrorStep, Info from (SELECT * from results where ENV='UAT' GROUP BY Test, Type, State, ENV ORDER BY time DESC limit 1) Where Result='Failed' GROUP BY Test, Type, State, ENV ORDER BY time DESC
Thank you for any and all help in advanced