Error parsing query: found (, expected identifier at line 1, char 45

Hi All,

I see the following error in the query when try to retrieve the error rate % from grafana :

error:“error parsing query: found (, expected identifier at line 1, char 45”

message:“error parsing query: found (, expected identifier at line 1, char 45”

config:undefined

Query :

SELECT sum(“success”) / sum(“all”)*100 FROM (SELECT sum(“count”) AS “all” FROM “$measurement_name” WHERE “transaction” = ‘all’ AND “application” =~ /^application/ AND timeFilter GROUP BY time(__interval) fill(null)), (SELECT sum(“count”)-sum(“countError”) AS “success” FROM “$measurement_name” WHERE “transaction” = ‘all’ AND “application” =~ /^application/ AND timeFilter GROUP BY time(__interval) fill(null))

Requesting help on this to resolve the error. Thank You.

Hello @Karthika,

You’re close, but I think you want your query to look something more like this:

SELECT sum("success")/sum("all")*100 AS "percent" FROM (SELECT count("usage_system") AS "all", (count("usage_system")-mean("usage-user")) AS "success" FROM "telegraf"."autogen"."cpu" WHERE time > :dashboardTime: AND time < :upperDashboardTime:)
```

Please let me know if that helps, or if I misunderstood.

Ps. I think this query would be a lot easier with Flux. Grafana now offers support for flux, I recommend checking it out!
https://www.influxdata.com/blog/how-grafana-dashboard-influxdb-flux-influxql/

Thank you!

Hi @Anaisdg ,

SETUP : (grafana + influxdb+ Jmeter)

Thanks for the reply . Actually i am trying to query "Error rate percentage " from influx db through grafana.

And i am trying to resolve the below query error from influxdb :

ERROR : error:“error parsing query: found (, expected identifier at line 1, char 45”

Even currently i tried to change the query as you suggested but still i am getting this error :
ERROR: error:“error parsing query: found (, expected identifier at line 1, char 58”

QUERY:
SELECT sum(“success”) / sum(“all”)*100 FROM (SELECT sum(“count”) AS “all” FROM “$measurement_name” WHERE “transaction” = ‘all’ AND “application” =~ /^application/ AND timeFilter GROUP BY time(__interval) fill(null)), (SELECT sum(“count”)-sum(“countError”) AS “success” FROM “$measurement_name” WHERE “transaction” = ‘all’ AND “application” =~ /^application/ AND timeFilter GROUP BY time(__interval) fill(null))

Requesting help to resolve the error in the query.

Thank you.

Hello. @Karthika,
I’m confused. Was the query I sent you not good? I rewrote your query to do what you want (with different data of course).