WHERE命令不起作用

时间:2018-05-13 21:31:30

标签: sql influxdb

在使用Influxql时,我尝试以下命令

select "P_askbid_midprice1" from "/HFT/Data_HFT/OrderBook/DCIX_OB" limit 50

我得到了以下结果

name: /HFT/Data_HFT/OrderBook/DCIX_OB
time                 P_askbid_midprice1
----                 ------------------
2015-05-30T00:00:00Z 0
2015-05-30T00:00:01Z 0
2015-05-30T00:00:02Z 0
2015-05-30T00:00:03Z 0
2015-05-30T00:00:04Z 0
2015-05-30T00:00:05Z 0
2015-05-30T00:00:06Z 0
2015-05-30T00:00:07Z 0
2015-05-30T00:00:08Z 0
2015-05-30T00:00:09Z 0
2015-05-30T00:00:10Z 0
2015-05-30T00:00:11Z 0
2015-05-30T00:00:12Z 0
2015-05-30T00:00:13Z 0
2015-05-30T00:00:14Z 0
2015-05-30T00:00:15Z 0
2015-05-30T00:00:16Z 0
2015-05-30T00:00:17Z 0
2015-05-30T00:00:18Z 0
2015-05-30T00:00:19Z 0
2015-05-30T00:00:20Z 0
2015-05-30T00:00:21Z 0
2015-05-30T00:00:22Z 0
2015-05-30T00:00:23Z 0
2015-05-30T00:00:24Z 0
2015-05-30T00:00:25Z 0
2015-05-30T00:00:26Z 0
2015-05-30T00:00:27Z 0
2015-05-30T00:00:28Z 0
2015-05-30T00:00:29Z 0
2015-05-30T00:00:30Z 0
2015-05-30T00:00:31Z 0
2015-05-30T00:00:32Z 0
2015-05-30T00:00:33Z 0
2015-05-30T00:00:34Z 0
2015-05-30T00:00:35Z 0
2015-05-30T00:00:36Z 0
2015-05-30T00:00:37Z 0
2015-05-30T00:00:38Z 0
2015-05-30T00:00:39Z 0
2015-05-30T00:00:40Z 0

但是使用命令

select "P_askbid_midprice1" from "/HFT/Data_HFT/OrderBook/DCIX_OB" WHERE time > '2016-05-30' and time < '2015-05-31'

即使它与前一个命令非常相似,我也没有得到任何命令。

该命令有什么问题?

1 个答案:

答案 0 :(得分:1)

您需要使用or语句而不是and语句。时间不能同时是“2015年5月之后”之前的“2​​015年5月之前”。它必须是一个另一个。

select "P_askbid_midprice1" 
from "/HFT/Data_HFT/OrderBook/DCIX_OB" 
WHERE 
    time > '2016-05-30' 
    or time < '2015-05-31'