Error 1064 in Grafana for making a graph using mysql database

流过昼夜 提交于 2020-02-05 14:00:05

问题


I am using Grafana to make a graph of my data. I have 4 columns. The Time(using variable f), 2 sensor variables (int1 and int2) and ID.

But I receive the error:

Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'int1 FROM data5 WHERE f BETWEEN FROM_UNIXTIME(1563773333) AND FROM_UNIXTIME(15' at line 3

This is the generated code:

    SELECT
       f AS "time",
       int1
    FROM data5
    WHERE
       f BETWEEN FROM_UNIXTIME(1563775600) AND FROM_UNIXTIME(1563797200)
    ORDER BY f

回答1:


select created_at as time,id 
from table 
where created_at between FROM_UNIXTIME(1542196778) and FROM_UNIXTIME(1545893190) 
ORDER BY created_at;

this should work



来源:https://stackoverflow.com/questions/57145848/error-1064-in-grafana-for-making-a-graph-using-mysql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!