问题
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