MySQL with multiple Query on a Graph!

Hi All,

I’m trying to get a graph with different timestamp, as you can see i get my diffrents days but all the query are recognzied as unknow
:

How i can renamed my Query ?

I try with SET function or variable directly in the query but doesn’t work !

Hi,

Can you please provide the query you’re using. Thanks

Also, I recommend you check the documentation if you haven’t done that.

Marcus

Hi,

Screen of all my queries ;

SELECT COUNT(DISTINCT login) as value, UNIX_TIMESTAMP(when) as time_sec
FROM logs

WHERE type_login= ‘wifi-event’ AND when BETWEEN ‘2017-10-14 08:00:00’ AND ‘2017-10-14 20:00:00’
AND
type=‘login’

GROUP BY
DATE(when), HOUR( when )

I change my BETWEEN just to match with the date of day !

Thanks.

According to documentation you need to add a column named metric:

If you set Format as to Time series, for use in Graph panel for example, then there are some requirements for what your query returns.

  • Must be a column named time_sec representing a unix epoch in seconds.
  • Must be a column named value representing the time series value.
  • Must be a column named metric representing the time series name.

Example:

SELECT
  min(UNIX_TIMESTAMP(time_date_time)) as time_sec,
  max(value_double) as value,
  metric1 as metric
FROM test_data
WHERE   $__timeFilter(time_date_time)
GROUP BY metric1, UNIX_TIMESTAMP(time_date_time) DIV 300
ORDER BY time_sec asc

Please try this

Marcus

Thanks mefraimsson, in fact i have to use systematicly Time Series when i want to drawn a graph.

I will try and i come back to show you my result.