Grafana Query Returns No Data for a Simple MySQL Query (works as expected in query inspector)

What happened?

The following two queries work as expected via MySQL and the grafana query inspector shows the expected values, but the 2nd query returns no data for the gauge panel.

Working Query:
SELECT
count(distinct vm_type, test_area, test_name),
end_start_time AS “time”
FROM NewTestResults
WHERE
$__timeFilter(end_start_time)
ORDER BY time

Non Working Query:
SELECT
count(distinct vm_type, test_area, test_name, test_subname),
end_start_time AS “time”
FROM NewTestResults
WHERE
$__timeFilter(end_start_time)
ORDER BY time

What was expected to happen?

That the 2nd query from above returns data

Steps to reproduce the problem:

  1. Have a MySQL table with several column values

  2. Select count distinct for a combination of several columns i.e count(distinct col1, col2, col3, col4)

  3. No data is returned

  4. Grafana CLI version 7.4.3

  5. OS: Windows 10


HI @jjackson,

I’m not sure I understand where the issue is. Are you saying that your SQL query with test_subname works when you query MySQL directly, but not through Grafana? What does that data look like?