Grafana pie chart with mssql

Plot top k items using pie chart plugin using sql server query and format as table

you should give a better description.

Only works with Time series, ie:

SELECT __timeGroup([data], '60m') as time, motivo as metric, SUM(qtde) AS QTDE FROM [xxx] WHERE [data] BETWEEN __timeFrom() AND __timeTo() GROUP BY __timeGroup([data], ‘60m’), [motivo]
ORDER BY 2 DESC