Plotting data from multiple tables in Grafana

Hey everyone,

I’m currently working on a project where I’m using Grafana to visualize data from a SQLite database. I have multiple tables in my database, and I want to plot data from these tables on the same graph in Grafana.I’m using SQlite plugin.

I’ve been using the following query to plot data from a single table:

SELECT 
  strftime('%Y-%m-%dT%H:%M:%SZ', "index") AS time,
  "0" AS value
FROM "$NomTable"
ORDER BY "index" ASC;

However, I’m not sure how to modify this query to plot data from multiple tables on the same graph.

Could someone please help me modify my query ?

Thanks in advance!

what is your datasource, the issue is more datasource than a grafana issue

I’ve a SQLITE database.

In this case, it’s working because I selected only one table, named “Top PB_150_TI_100_KD_200000_IntLim_O_Text_5”. So the variable $NomTable is equal to “Top PB_150_TI_100_KD_200000_IntLim_O_Text_5”. However, if I select two tables, for example, “Top PB_150_TI_100_KD_200000_IntLim_O_Text_5” and “Top PB_150_TI_100_KD_160000_IntLim_O_Text_5”, then the variable $NomTable becomes “PB_150_TI_100_KD_200000_IntLim_O_Text_5,Top PB_150_TI_100_KD_160000_IntLim_O_Text_5”, and my query stops working (which is normal due to a flawed SQL query).

My question is, how can I modify my query to make it work? Is it possible to adjust the query to handle the selection of more than one table?