MySQL INNER JOIN giving no data

Using MySQL data source and following query containing INNER JOIN to get time series data. But it is giving Data is missing a number field error.

  count(id) AS "Total"
FROM plans_userplan up
INNER JOIN plans_planquota pq ON pq.plan_id = up.plan_id
INNER JOIN plans_quota q ON = pq.quota_id
INNER JOIN authentication_user u ON = up.user_id
  $__timeFilter(up.created) AND q.codename = 'CUSTOM_SCRIPT' 

But data is available in the database and can be retrieved using (modified query)

from plans_userplan up
inner join plans_planquota pq on pq.plan_id = up.plan_id
inner join plans_quota q on = pq.quota_id
INNER JOIN authentication_user u on = up.user_id
where q.codename = 'CUSTOM_SCRIPT' 

Remove the following from the WHERE filter in grafana and see what happens


@yosiasz Same error after removing $__timeFilter(up.created)

Oh sorry, can you use transformation and convert ghat Total field to Number?

Tried using the Convert field type transformation. but there is no option to select

Got it resolved by putting count(*). It seems the issue was due to the ambiguity of the id field in the count() function.

1 Like