Why this query error


If you run that query outside Grafana you’ll get the same error. This is wrongly formatted SQL.

You’re joining two tables that have at least one column with the same name. So in your where-clause you need to use a. or b. (the alias used for the tables) just like you’ve did in the select expression.



so how to solution


You got the solution right there :point_up_2:

i dont understand


Well you have used aliases (a and b) in the select clause so I find it a bit strange that you haven’t used it in the where clause.

In your select clause you’re using a.target_ip and b.target_host as example. In your where clause you don’t use the aliases, instead your writing metric_values > … and metric_name=… - you see no a. or b. here right.

I don’t know if it’s the metric_values or metric_name column that are in both tables, but you need to write a.metric_values > … or b.metric_values > … or a.metric_name=… or b.metric_name=… to make it explicit for which table and column you reference in your where clause.

Here no error and no data

I cannot help you further since I don’t have your data to play with.

You’ve probably mixed up something in your where clause resulting in no results.