I want to calculate the percentage of errors in jmeter load test results, this doc says Note that there can be multiple subqueries per main query, but I got the error as below:
SELECT 1 - "error" / "all" FROM (SELECT sum("value") AS "all" FROM "jmeter.a.count";SELECT sum("value") AS "error" FROM "jmeter.ko.count")
ERR: error parsing query: found ;, expected ) at line 1, char 84
The queries in () :
SELECT sum("value") AS "all" FROM "jmeter.a.count";SELECT sum("value") AS "error" FROM "jmeter.ko.count"
name: jmeter.a.count
time all
---- ---
0 584992
name: jmeter.ko.count
time error
---- -----
0 6016
Semi-colons are not allowed within sub-queries. Semi-colons indicate separate statement.
@rkuchan I think the docs might need to be clarified here.
@keithmork You could try:
SELECT 1 - "error" / "all" FROM (SELECT sum("value") AS "all" FROM "jmeter.a.count"), (SELECT sum("value") AS "error" FROM "jmeter.ko.count")
@jwilder The statement above doesn't work. It creates a new field "error_all":
name: jmeter.a.count
time error_all
---- ---------
0
name: jmeter.ko.count
time error_all
---- ---------
0
But this works, problem solved. Thank you : )
SELECT 1 - sum("error") / sum("all") FROM (SELECT sum("value") AS "all" FROM "jmeter.a.count"), (SELECT sum("value") AS "error" FROM "jmeter.ko.count")
When this is the way how it works (will also test with an own usecase) then it should also be added to documentation ... currently when reading docu one may think it is not supported at all ... :-)
InfluxQL does not support multiple SELECT statements per subquery: ...
I dont get this to work ...
I have two values with rain amounts as two different measurements... and I want to add them to get an "Intraday" info of rain-amount.
SELECT "week" + "today" FROM (SELECT last("value") as "week" FROM "javascript.0.Weather.Rain.Weekly"), (SELECT last("value") as "today" FROM "weatherunderground.0.current.precip_today_metric")
When running this with 1.2 in InfluxDB Admin then I get one resultset for each of the measurements with an empty value ... but I would want to have one with a sum.
What's wrong? Thank you for any support
When running this with 1.2 in InfluxDB Admin then I get one resultset for each of the measurements with an empty value ... but I would want to have one with a sum.
@Apollon77 I have the same problem with 1.4
maybe we should create a new issue?!
@Apollon77 , I found the key point. You should sum("week") and sum("today") to merge the results.
@kohsita, how can I merge the result? because, I executed and returned in two rows different.
while if I just select sql like upon separately.
select count("A") as "all" from table_name
select count("B") as "B" from table_name
it's work.
but when i'm tring combine it. by use
select 1- sum("all")/sum("all2") from (select count("A") as "all" from table_name), (select count("B") as "all2" from table_name)
I got none. don't know why, can anyone helps?
Most helpful comment
I dont get this to work ...
I have two values with rain amounts as two different measurements... and I want to add them to get an "Intraday" info of rain-amount.
SELECT "week" + "today" FROM (SELECT last("value") as "week" FROM "javascript.0.Weather.Rain.Weekly"), (SELECT last("value") as "today" FROM "weatherunderground.0.current.precip_today_metric")When running this with 1.2 in InfluxDB Admin then I get one resultset for each of the measurements with an empty value ... but I would want to have one with a sum.
What's wrong? Thank you for any support