Query for each value in template variable in table panel

I have values being stored in multiple tables that all start with the same prefix “ab”
I wish to display the last row from each table in the table panel, along with the table name as the first column. I am able to pull all the table names in a template variable. How can I use the values in the template variable in the query.

Data Source is MySQL.
Using latest Grafana 5.4.3.

Please help me

1 Like

SELECT table from AB_{table:raw}

Thanks, so what is table:raw in your example? where do I use the variable name?

the list of table names are in the variable dropdown but I do not want values from the selected variable, rather I want to pull from all values in the dropdown.

so like select * from {tablename} but it should be like a loop, so the query runs on all tables in the dropdown and outputs one row and each row represents one table in the table panel.

1 Like