Hey guys and gals,
I have been asked to produce a piechart on the dashboard which shows 2 values. Where date is either side of a set value (20 minutes).
SELECT COUNT(*)
FROM `tableName`
WHERE datecolumn > DATE_SUB(NOW(),INTERVAL 20 MINUTE)
SELECT COUNT(*)
FROM `tableName`
WHERE datecolumn < DATE_SUB(NOW(),INTERVAL 20 MINUTE)
I can get this into a table as follows, but can work out how to make this work with the pie chart:
SELECT
NOW() AS time_sec,
COUNT() AS “Value1”,
(SELECT COUNT()
FROM tableName
WHERE datecolumn > DATE_SUB(NOW(),INTERVAL 20 MINUTE) AS “Value2”
FROM
tableName
WHERE datecolumn < DATE_SUB(NOW(),INTERVAL 20 MINUTE)
Can anyone advise? I am sure with Grafana this should be easier since I am using time data.