Mysql timestamp help

i am using grafana latest version , i have my simple mysql database like this:

table: data

and columns

how i am setup the Graph panel?

i am trying hours , read some other answers , but still no success?

anyone can show me how.

thanks!

here is an example query from the mysql query docs:

SELECT
min(UNIX_TIMESTAMP(timestamp)) as time_sec,
max(event) as value,
locationID as metric
FROM test_data
WHERE $__timeFilter(timestamp)
GROUP BY metric1, UNIX_TIMESTAMP(timestamp) DIV 300
ORDER BY time_sec asc

First , thank you for your reply and help!

now i have copy/paste your solution

but i have this error

Error 1054: Unknown column ‘metric1’ in ‘group statement’

so i have change the metric1 to metric

good no errors!

but! No data points! :frowning:

You’re selecting the minimum timestamp which is probably outside the time range you selected.

Please try a simpler query like

SELECT
  $__time(timestamp),
  event as value,
  locationID as metric
FROM data
WHERE 
  $__timeFilter(timestamp)
ORDER BY time_sec ASC

And please read the documentation to get a better understandidng.

Marcus