mgrimm, thanks for your reply. As I wrote in my other topic, singlestat does not show the options in your picture. I assume we have different versions.
Anyway, your reply indicates that only static pre/postfixes are possible.
What about the following query, which results in my grafana version also in a ‘no data’ but in mysql-workbench I get the expected result
SELECT
CASE
WHEN mydb.status = 0 THEN CONCAT ( mydb.status , ': logged-out')
WHEN mydb.status = 1 THEN CONCAT ( mydb.status , ': ready')
WHEN mydb.status = 2 THEN CONCAT ( mydb.status , ': busy')
ELSE 'UNDEF'
END AS STATUS
FROM
mydb
WHERE 1=1
AND agentid = 11
AND DATE(mydb.thetime) =CURDATE()
ORDER BY mydb.thetime DESC LIMIT 1;
What about a connection between two tables , the query replies a varchar not a number. Are only numbers allowed ( cause if the query selects namestab.key it returns data ) ?
SELECT namestab.name
FROM
mydb , namestab
WHERE 1=1
AND agentid = 11
AND DATE(mydb.thetime) =CURDATE()
AND namestab.key = mydb.agentid
ORDER BY mydb.thetime DESC LIMIT 1;
Is there a documentation for the single stat ?
Does the ‘number-restriction’ apply only to a mysql source or also to other (db-)sources like e.g. oracle ?
Now the Grafana 7 Version:
You ca do the conversion to text in the query, but you are more flexible if you’re passing just the numbers to grafana and use “value mapping” for text conversion and the “thresholds” for coloring the single stats.