查询influxdb日期 [英] Query influxdb for a date
问题描述
我在influxdb中有一个表,该表中有一个名为"expirydate"的列.在此栏中,我有一些日期,例如"2016-07-14"或"2016-08-20".我只想选择2016年7月14日,但是我不确定如何选择? 我的查询当前是:
I have a table in influxdb that has a column called 'expirydate'. In the column I have afew dates e.g. "2016-07-14" or "2016-08-20". I want to select only the 2016-07-14 date, but I am unsure how? My query is currently:
SELECT * FROM tablee where expirydate = '2016-07-14' limit 1000
但这不起作用.有人可以帮我吗?
But this does not work. Can someone please help me?
推荐答案
假定值table**e**
是有效的度量...
Assuming the value table**e**
is a valid measurement...
如果您要选择"2016-07-14"这一天的所有时间点,那么您的查询应该类似于.
If you are looking at selecting all of the points for the day '2016-07-14', then your query should look something like.
查询:
SELECT * FROM tablee where time >= '2016-07-14 00:00:00' and time < '2016-07-15 00:00:00'
您可能还对查询中涌入的日期时间字符串感兴趣.
You might also be interested in the influx's date time string in query.
参阅: https://docs.influxdata.com/influxdb/v0. 9/query_language/data_exploration/#relative-time
日期时间字符串
用日期时间字符串指定时间.约会时间 字符串可以采用两种格式:YYYY-MM-DD HH:MM:SS.nnnnnnnnn和 YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ,其中第二个规范是 RFC3339.纳秒(nnnnnnnnn)在两种格式中都是可选的.
Date time strings
Specify time with date time strings. Date time strings can take two formats: YYYY-MM-DD HH:MM:SS.nnnnnnnnn and YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ, where the second specification is RFC3339. Nanoseconds (nnnnnnnnn) are optional in both formats.
注意:
limit
api在原始查询中可能是多余的,因为它对查询施加了限制,使其无法返回1000个以上的点数据.
Note:
The limit
api could be redundant in your original query as it is there to impose restriction to the query from returning more than 1,000 point data.
这篇关于查询influxdb日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!