I have a table with 2 columns: TimeStamp and Description.
TimeStamp is DateTime and Description is nvarcahr(512)
Each time when production starts or stops, in this table are inserted values like:
TimeStamp Description 15.11.2019 22:50:00 Line 1 ON 15.11.2019 23:00:00 Line 1 OFF
So, in Grafana I would like to present only the data from the description column, but showing “Started/Stopped” instead of “Line 1 ON” and the color of background of the panel to change green/red depending of the status.
I have tried with this query
SELECT top 1 Description FROM dbo.ProductionLog CASE WHEN Description=='Line 1 ON' then 1 when Description=='Line 1 OFF' then 0 ELSE ERROR END order by ProductionLogID DESC
but no results.
Can someone help me please?