How to name series with MySQL?

I’m using MySQL for graph data. I didn’t found a way how to name a serie from MySQL, so i can end with few “unknown” series in graph. Is there any way?

Hi,

If you read the documentation wou’ll find that you can include a column named metric, the value of that column will be the name of the series.

Marcus

Thanks, i’ve been there, but i was looking for bad keyword on this page. Anyway, so far i’m not able to name it with some string (“Uptime” for example), but hopefully somebody more skilled with SQL will help me. Just to be clear - i’m refering to what is named “Alias by” in InfluxDB query.

I don’t really understand your problem then? Are you using single quotes?

If you do a select like

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

Suppose your query returns data, you now should have a series named my custom series name.

Syntax error (comma).

Thanks for your patience.

Please include the query you’re using

Thanks

Error was on my side, i omnited comma when added new row in SQL query. Sorry for that.

1 Like