Equivalent Grafana query for Mysql query

Hi Myself Gireesh, Currently i am using Grafna in my project and i am new to this tool. I don’t know how to execute this query in Grafana, the query is “SELECT TIMEDIFF(out_timestamp,in_timestamp) AS dif,id FROM POC_G_NEW.in_out_data order by id”. i want to see the result in all Visualization formats in Grafana, so please reply with correct query to execute in Grafana.

1 Like

I was having same use case almost. I used DATEDIFF and it works for me

Select
StationTime as time,
DATEDIFF(minute, TimeStamp, Stationtime) as value,

StationFullPath
FROM MachineHistory.MachineStateHistoryLogging
order by StationFullPath, Stationtime

Might be this will be helpful for you.

Thanks for immediate reply, i want to know how many columns in your query you consider, this is the query i written in mysql and i got the desired result also, so please help me to write query in grafana.

As you can see above query i have selected 3 columns one is time and second one is value and third one is used as a legend. You can easily plot it on grafana.

Thank you so much @alamgir for your reply, with your help only i created dashboard in Grafana.

1 Like