Hi Community
Need your help.
I am testing and trying to learn grafana.
I have successfully connected MariaDB to grafana using the mysql plugin and able to chart the timeseries using below query
SELECT
$__timeGroupAlias(datetime,$__interval,0),
count(items) AS “No of Items sold”
FROM itemsales
GROUP BY 1
ORDER BY $__timeGroup(datetime,$__interval,0
Its properly showing the timeseries with the count of items sold over time. I am trying to find the item names sold when i point the cursor on map along with count. I have tried adding the items column, but its listing all items and not just the items at that point of time. Below query is not giving what i am looking for. Please suggest
SELECT
$__timeGroupAlias(datetime,$__interval,0),
count(items) AS “items”,
items AS “items”
FROM itemsales
GROUP BY 1
ORDER BY $__timeGroup(datetime,$__interval,0)
Data in DB table looks like below
items,datetime,ID
apples,2019-03-12 17:03:06,1
oranges,2019-03-12 17:03:48,2
mangoes,2019-03-12 17:03:10,3
apples,2019-03-12 12:03:18,4
mangoes,2019-03-12 11:03:16,5
kiwi,2019-03-12 11:03:12,6
strawberry,2019-03-12 16:03:14,7
oranges,2019-03-12 10:03:26,8
Thanks in advance