How to Join columns from two different tables from sql database and present it as a single table in grafana

Grafana version : V9.2.1 opensource
Database : MySQL

What am I trying to achieve?
I am trying to JOIN two tables which is having one common column for visualisation

How am I trying to achieve it?
I tried using SQL query inner join

[SELECT py.data.headid, py.data.duration, py.data.saporder, py.data.nofcu, py.header.week, py.header.version
FROM (py.data
INNER JOIN py.header ON py.data.headid = py.header.id)
ORDER BY id DESC LIMIT 50]

What happened?
I get an error with “db query error: query failed - please inspect Grafana server log for details”

What did I expect to happen?
The columns from two tables mentioned in the query in a single table

@yosiasz Thank you so much for your solution query. Apologise me for my ignorance, I am newbie in coding query and data stuff. Your query gives me the solution. Can you also explain me the reason behind it so I can the understand it precisely?

1 Like