InfluxDB 使用InfluxQL语言检索数据语法

官方文档
InfluxQL是一种类似SQL的查询语言,用于与InfluxDB中的数据交互。以下各节详细介绍了InfluxQL的SELECT语句和用于探索数据的有用查询语法。

The Basics: Configure Query Results: General Tips on Query Syntax:
The SELECT statement ORDER BY time DESC Time Syntax
The WHERE clause The LIMIT and SLIMIT clauses Regular Expressions
The GROUP BY clause The OFFSET and SOFFSET clauses Data types and cast operations
The INTO clause The Time Zone clause Merge behavior
Multiple statements
Subqueries

The basic SELECT statement

SELECT语句从特定的measurement或measurements中查询数据。

SELECT <field_key>[,<field_key>,<tag_key>] FROM <measurement_name>[,<measurement_name>]

The SELECT statement requires a SELECT clause and a FROM clause.

SELECT子句

SELECT子句支持几种指定数据的格式:
SELECT * Returns all fields and tags.

SELECT "<field_key>" Returns a specific field.

SELECT "<field_key>","<field_key>"Returns more than one field.

SELECT "<field_key>","<tag_key>" Returns a specific field and tag. The SELECT clause must specify at least one field when it includes a tag.

SELECT "<field_key>"::field,"<tag_key>"::tag Returns a specific field and tag. The ::[field | tag] syntax specifies the identifier’s type. Use this syntax to differentiate between field keys and tag keys that have the same name.

FROM子句

SELECT子句支持几种指定数据的格式:
FROM <measurement_name>返回单个度量的数据。如果使用的是CLI influxdb,则查询所用数据库中的度量值和默认保留策略。如果使用influxdb API influxdb查询数据库中在db query string参数和默认保留策略中指定的度量值。

FROM <measurement_name>,<measurement_name> Returns data from more than one measurement.

FROM <database_name>.<retention_policy_name>.<measurement_name>从完全限定的度量返回数据。通过指定度量值的数据库和保留策略来完全限定度量值。

FROM <database_name>..<measurement_name>返回用户指定数据库中默认保留测量的度量值的数据.

Quoting引用

如果标识符包含除[A-z,0-9,u]以外的字符,如果它们以数字开头,或者如果它们是InfluxQL关键字,则必须使用双引号。虽然并不总是必要的,但我们建议您对标识符进行双引号。

注意:查询的引用语法与行协议不同。请查看查询中单引号和双引号的规则。

示例:
Select all fields and tags from a single measurement

> SELECT * FROM "h2o_feet"

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica   2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica   4.938

如果您使用的是CLI,请确保在运行查询之前输入USE NOAA_water_database。CLI查询所用数据库中的数据和默认保留策略。如果使用influxDB API,请确保将db query string参数设置为NOAA_water_database数据库。如果未设置rp query string参数,InfluxDB API将自动查询数据库的默认保留策略。
Select specific tags and fields from a single measurement

> SELECT "level description","location","water_level" FROM "h2o_feet"

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica   2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica   4.938

The query selects the level description field, the location tag, and the water_level field.请注意,SELECT子句在包含tag时必须至少指定一个field。
Select specific tags and fields from a single measurement, and provide their identifier type

> SELECT "level description"::field,"location"::tag,"water_level"::field FROM "h2o_feet"

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica   2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica   4.938

The query selects the level description field, the location tag, and the water_level field from the h2o_feet measurement.::[field | tag]语法指定标识符是字段还是标记。使用::[field | tag]区分相同的字段键和标记键。大多数用例都不需要这种语法。

Select all fields from a single measurement

> SELECT *::field FROM "h2o_feet"

name: h2o_feet
--------------
time                   level description      water_level
2015-08-18T00:00:00Z   below 3 feet           2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   4.938

The query selects all fields from the h2o_feet measurement. The SELECT clause supports combining the * syntax with the :: syntax.

Select a specific field from a measurement and perform basic arithmetic

> SELECT ("water_level" * 2) + 4 FROM "h2o_feet"

name: h2o_feet
--------------
time                   water_level
2015-08-18T00:00:00Z   20.24
2015-08-18T00:00:00Z   8.128
[...]
2015-09-18T21:36:00Z   14.132
2015-09-18T21:42:00Z   13.876

The query multiplies water_level’s field values by two and adds four to those values. Note that InfluxDB follows the standard order of operations. See Mathematical Operators for more on supported operators.

Select all data from more than one measurement

> SELECT * FROM "h2o_feet","h2o_pH"

name: h2o_feet
--------------
time                   level description      location       pH   water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica        2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek        8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica        5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica        4.938

name: h2o_pH
------------
time                   level description   location       pH   water_level
2015-08-18T00:00:00Z                       santa_monica   6
2015-08-18T00:00:00Z                       coyote_creek   7
[...]
2015-09-18T21:36:00Z                       santa_monica   8
2015-09-18T21:42:00Z                       santa_monica   7

查询从两个测量值中选择所有字段和标记:h2o_feet and h2o_pH.用逗号(,)分隔多个测量值。

Select all data from a fully qualified measurement
从完全限定测量中查询所有数据

> SELECT * FROM "NOAA_water_database"."autogen"."h2o_feet"

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica   2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica   4.938

查询选择NOAA_water_darabase中的数据、autogen保留策略和h2o_feet。
在CLI中,完全限定一个度量值,以查询使用的数据库以外的数据库和默认保留策略以外的保留策略中的数据。在InfluxDB API中,如果需要,完全限定度量值,而不是使用dbrp查询字符串参数。

Select all data from a measurement in a particular database

> SELECT * FROM "NOAA_water_database".."h2o_feet"

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   below 3 feet           santa_monica   2.064
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
[...]
2015-09-18T21:36:00Z   between 3 and 6 feet   santa_monica   5.066
2015-09-18T21:42:00Z   between 3 and 6 feet   santa_monica   4.938

查询选择NOAA_water_darabase中的数据、默认保留策略和h2o_feet测量值。这个..指示指定数据库的默认保留策略。
在CLI中,指定要在已用数据库以外的数据库中查询数据的数据库。在InfluxDB API中,如果需要,指定数据库以代替使用db query string参数。

SELECT语句的常见问题

Selecting tag keys in the SELECT clause
查询要求SELECT子句中至少有一个字段键才能返回数据。如果SELECT子句只包含一个标记键或多个标记键,则查询返回空响应。此行为是系统存储数据方式的结果。
例子
以下查询不返回数据,因为它在SELECT子句中指定了单个标记键(位置):

> SELECT "location" FROM "h2o_feet"

若要返回任何和location标签键相关联的数据,SELECT查询语句至少包含一个字段键(water_level):

> SELECT "water_level","location" FROM "h2o_feet"
name: h2o_feet
time                   water_level  location
----                   -----------  --------
2015-08-18T00:00:00Z   8.12         coyote_creek
2015-08-18T00:00:00Z   2.064        santa_monica
[...]
2015-09-18T21:36:00Z   5.066        santa_monica
2015-09-18T21:42:00Z   4.938        santa_monica

The WHERE clause

The WHERE filters data based on fields, tags, and/or timestamps.

SELECT_clause FROM_clause WHERE <conditional_expression> [(AND|OR) <conditional_expression> [...]]

The WHERE clause supports conditional_expressions on fields, tags, and timestamps.

注意InfluxDB不支持在WHERE子句中使用或指定多个时间范围。例如,InfluxDB将为以下查询返回空响应:

> SELECT * FROM "absolutismus" WHERE time = '2016-07-31T20:07:00Z' OR time = '2016-07-31T23:07:17Z'

Fields

field_key <operator> ['string' | boolean | float | integer]

WHERE子句支持string、boolean、float和integer字段值进行比较。
WHERE子句中使用单引号字符串字段值。使用非引号字符串字段值或双引号字符串字段值的查询不会返回任何数据,并且在大多数情况下不会返回错误。
Supported operators:

Operator Meaning
= equal to
<> not equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to

Tags

tag_key <operator> ['tag_value']

WHERE子句中使用单引号标签值(tag values)。使用非引号字符串字段值或双引号字符串字段值的查询不会返回任何数据,并且在大多数情况下不会返回错误。
Supported operators:

Operator Meaning
= equal to
<> not equal to
!= not equal to

Timestamps

对于大多数SELECT语句,默认时间范围是在1677-09-21 00:12:43.1452241942262-04-11T23:47:16.854775806Z UTC之间。对于带有GROUP BY time()子句的SELECT语句,默认时间范围是1677-09-21 00:12:43.145224194 UTC和now()之间。
此页上的Time语法部分详细说明如何在WHERE子句中指定可选时间范围。

示例:

Select data that have specific field key-values

> SELECT * FROM "h2o_feet" WHERE "water_level" > 8

name: h2o_feet
--------------
time                   level description      location       water_level
2015-08-18T00:00:00Z   between 6 and 9 feet   coyote_creek   8.12
2015-08-18T00:06:00Z   between 6 and 9 feet   coyote_creek   8.005
[...]
2015-09-18T00:12:00Z   between 6 and 9 feet   coyote_creek   8.189
2015-09-18T00:18:00Z   between 6 and 9 feet   coyote_creek   8.084

The query returns data from the h2o_feet measurement with field values of water_level that are greater than eight.

Select data that have a specific string field key-value

> SELECT * FROM "h2o_feet" WHERE "level description" = 'below 3 feet'

name: h2o_feet
--------------
time                   level description   location       water_level
2015-08-18T00:00:00Z   below 3 feet        santa_monica   2.064
2015-08-18T00:06:00Z   below 3 feet        santa_monica   2.116
[...]
2015-09-18T14:06:00Z   below 3 feet        santa_monica   2.999
2015-09-18T14:36:00Z   below 3 feet        santa_monica   2.907

The query returns data from the h2o_feet measurement with field values of level description that equal the below 3 feet string. InfluxQL requires single quotes around string field values in the WHERE clause.

Select data that have a specific field key-value and perform basic arithmetic

> SELECT * FROM "h2o_feet" WHERE "water_level" + 2 > 11.9

name: h2o_feet
--------------
time                   level description           location       water_level
2015-08-29T07:06:00Z   at or greater than 9 feet   coyote_creek   9.902
2015-08-29T07:12:00Z   at or greater than 9 feet   coyote_creek   9.938
2015-08-29T07:18:00Z   at or greater than 9 feet   coyote_creek   9.957
2015-08-29T07:24:00Z   at or greater than 9 feet   coyote_creek   9.964
2015-08-29T07:30:00Z   at or greater than 9 feet   coyote_creek   9.954
2015-08-29T07:36:00Z   at or greater than 9 feet   coyote_creek   9.941
2015-08-29T07:42:00Z   at or greater than 9 feet   coyote_creek   9.925
2015-08-29T07:48:00Z   at or greater than 9 feet   coyote_creek   9.902
2015-09-02T23:30:00Z   at or greater than 9 feet   coyote_creek   9.902

The query returns data from the h2o_feet measurement with field values of water_level plus two that are greater than 11.9. Note that InfluxDB follows the standard order of operations See Mathematical Operators for more on supported operators.

Select data that have a specific tag key-value

> SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica'

name: h2o_feet
--------------
time                   water_level
2015-08-18T00:00:00Z   2.064
2015-08-18T00:06:00Z   2.116
[...]
2015-09-18T21:36:00Z   5.066
2015-09-18T21:42:00Z   4.938

The query returns data from the h2o_feet measurement where the tag key location is set to santa_monica. InfluxQL requires single quotes around tag values in the WHERE clause.

Select data that have specific field key-values and tag key-values

> SELECT "water_level" FROM "h2o_feet" WHERE "location" <> 'santa_monica' AND (water_level < -0.59 OR water_level > 9.95)

name: h2o_feet
--------------
time                   water_level
2015-08-29T07:18:00Z   9.957
2015-08-29T07:24:00Z   9.964
2015-08-29T07:30:00Z   9.954
2015-08-29T14:30:00Z   -0.61
2015-08-29T14:36:00Z   -0.591
2015-08-30T15:18:00Z   -0.594

The query returns data from the h2o_feet measurement where the tag key location is not set to santa_monica and where the field values of water_level are either less than -0.59 or greater than 9.95. The WHERE clause supports the operators AND and OR, and supports separating logic with parentheses.

Select data that have specific timestamps

> SELECT * FROM "h2o_feet" WHERE time > now() - 7d

Common issues with the WHERE clause

WHERE子句查询意外地未返回任何数据
在大多数情况下,此问题是由于标记值(tag values)或字符串字段值(field values)周围缺少单引号造成的。带有无引号或双引号标记值或字符串字段值的查询不会返回任何数据,并且在大多数情况下不会返回错误。
下面代码块中的前两个查询尝试指定标记值santa_monica,不带任何引号,带双引号。这些查询不返回结果。第三个查询单引号santa_monica(这是支持的语法)并返回预期结果。

> SELECT "water_level" FROM "h2o_feet" WHERE "location" = santa_monica

> SELECT "water_level" FROM "h2o_feet" WHERE "location" = "santa_monica"

> SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica'

name: h2o_feet
--------------
time                   water_level
2015-08-18T00:00:00Z   2.064
[...]
2015-09-18T21:42:00Z   4.938

下面代码块中的前两个查询尝试指定不带任何引号和双引号的长度大于或等于9英尺的字符串字段值。第一个查询返回一个错误,因为字符串字段值包含空格。第二个查询不返回结果。第三个查询单引号位于或大于9英尺(这是支持的语法)并返回预期结果。

> SELECT "level description" FROM "h2o_feet" WHERE "level description" = at or greater than 9 feet

ERR: error parsing query: found than, expected ; at line 1, char 86

> SELECT "level description" FROM "h2o_feet" WHERE "level description" = "at or greater than 9 feet"

> SELECT "level description" FROM "h2o_feet" WHERE "level description" = 'at or greater than 9 feet'

name: h2o_feet
--------------
time                   level description
2015-08-26T04:00:00Z   at or greater than 9 feet
[...]
2015-09-15T22:42:00Z   at or greater than 9 feet

The GROUP BY clause

GROUPBY子句按用户指定的标记集或时间间隔对查询结果进行分组。

GROUP BY tags
GROUP BY time intervals: Basic Syntax Advanced Syntax GROUP BY time intervals and fill()

GROUP BY tags

GROUP BY<tag>查询按用户指定的标记集对查询结果进行分组。

SELECT_clause FROM_clause [WHERE_clause] GROUP BY [* | <tag_key>[,<tag_key]]

GROUP BY * Groups results by all tags

GROUP BY <tag_key> Groups results by a specific tag

GROUP BY <tag_key>,<tag_key> Groups results by more than one tag. The order of the tag keys is irrelevant.

如果查询包含WHERE子句,则GROUP BY子句必须出现在WHERE子句之后。

示例

Group query results by a single tag

> SELECT MEAN("water_level") FROM "h2o_feet" GROUP BY "location"

name: h2o_feet
tags: location=coyote_creek
time			               mean
----			               ----
1970-01-01T00:00:00Z	 5.359342451341401


name: h2o_feet
tags: location=santa_monica
time			               mean
----			               ----
1970-01-01T00:00:00Z	 3.530863470081006

查询使用InfluxQL函数计算water_level测量中每个位置标记值的平均水位。InfluxDB返回两个series的结果:location的每个标记值对应一个序列。

注意:在InfluxDB中,epoch 0(1970-01-01T00:00:00Z)通常用作空时间戳等价物。如果请求的查询没有时间戳可返回,例如具有无限时间范围的聚合函数,InfluxDB将epoch 0作为时间戳返回。

Group query results by more than one tag

> SELECT MEAN("index") FROM "h2o_quality" GROUP BY "location","randtag"

name: h2o_quality
tags: location=coyote_creek, randtag=1
time                  mean
----                  ----
1970-01-01T00:00:00Z  50.69033760186263

name: h2o_quality
tags: location=coyote_creek, randtag=2
time                   mean
----                   ----
1970-01-01T00:00:00Z   49.661867544220485

name: h2o_quality
tags: location=coyote_creek, randtag=3
time                   mean
----                   ----
1970-01-01T00:00:00Z   49.360939907550076

name: h2o_quality
tags: location=santa_monica, randtag=1
time                   mean
----                   ----
1970-01-01T00:00:00Z   49.132712456344585

name: h2o_quality
tags: location=santa_monica, randtag=2
time                   mean
----                   ----
1970-01-01T00:00:00Z   50.2937984496124

name: h2o_quality
tags: location=santa_monica, randtag=3
time                   mean
----                   ----
1970-01-01T00:00:00Z   49.99919903884662

查询使用InfluxQL函数来计算h2o_quality度量中location标记和randtag标记的每个组合的平均索引。在GROUPBY子句中用逗号分隔多个标记。
Group query results by all tags

> SELECT MEAN("index") FROM "h2o_quality" GROUP BY *

name: h2o_quality
tags: location=coyote_creek, randtag=1
time			               mean
----			               ----
1970-01-01T00:00:00Z	 50.55405446521169


name: h2o_quality
tags: location=coyote_creek, randtag=2
time			               mean
----			               ----
1970-01-01T00:00:00Z	 50.49958856271162


name: h2o_quality
tags: location=coyote_creek, randtag=3
time			               mean
----			               ----
1970-01-01T00:00:00Z	 49.5164137518956


name: h2o_quality
tags: location=santa_monica, randtag=1
time			               mean
----			               ----
1970-01-01T00:00:00Z	 50.43829082296367


name: h2o_quality
tags: location=santa_monica, randtag=2
time			               mean
----			               ----
1970-01-01T00:00:00Z	 52.0688508894012


name: h2o_quality
tags: location=santa_monica, randtag=3
time			               mean
----			               ----
1970-01-01T00:00:00Z	 49.29386362086556

查询使用InfluxQL函数来计算h2o_quality度量中每个可能的标记组合的平均索引。
注意,查询结果与示例2中的查询结果相同,在示例2中,我们显式指定了locationrandtag标签键。这是因为h2o_quality测量只有两个标签键。

GROUP BY time intervals

GROUP BY time()查询按用户指定的时间间隔对查询结果进行分组。

SELECT <function>(<field_key>) FROM_clause WHERE <time_range> GROUP BY time(<time_interval>),[tag_key] [fill(<fill_option>)]

Basic GROUP BY time()查询需要SELECT子句中的InfluxQL函数和WHERE子句中的时间范围。注意GROUP BY子句必须在WHERE子句之后。
time(time_interval)
GROUP BY time()子句中的时间间隔是一个持续时间文本。它确定InfluxDB组随时间查询结果的方式。例如,在WHERE子句中指定的时间范围内,将时间间隔为5m的组查询结果分成5分钟的时间组。
fill(<fill_option>)
fill(<fill_option>) 是可选的。它更改没有数据的时间间隔的报告值。

Examples of basic syntax

The examples below use the following subsample of the sample data:

> SELECT "water_level","location" FROM "h2o_feet" WHERE time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:30:00Z'

name: h2o_feet
--------------
time                   water_level   location
2015-08-18T00:00:00Z   8.12          coyote_creek
2015-08-18T00:00:00Z   2.064         santa_monica
2015-08-18T00:06:00Z   8.005         coyote_creek
2015-08-18T00:06:00Z   2.116         santa_monica
2015-08-18T00:12:00Z   7.887         coyote_creek
2015-08-18T00:12:00Z   2.028         santa_monica
2015-08-18T00:18:00Z   7.762         coyote_creek
2015-08-18T00:18:00Z   2.126         santa_monica
2015-08-18T00:24:00Z   7.635         coyote_creek
2015-08-18T00:24:00Z   2.041         santa_monica
2015-08-18T00:30:00Z   7.5           coyote_creek
2015-08-18T00:30:00Z   2.051         santa_monica

Group query results into 12 minute intervals

> SELECT COUNT("water_level") FROM "h2o_feet" WHERE "location"='coyote_creek' AND time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:30:00Z' GROUP BY time(12m)

name: h2o_feet
--------------
time                   count
2015-08-18T00:00:00Z   2
2015-08-18T00:12:00Z   2
2015-08-18T00:24:00Z   2

查询使用InfluxQL函数计算water_level点的数量,标记location=coyote_creek,并将结果按12分钟的间隔分组。
每个时间戳的结果表示一个12分钟的间隔。第一个时间戳的计数包括2015-08-18T00:00:00Z2015-08-18T00:12:00Z之间的原始数据,但不包括上限;第二个时间戳的计数包括2015-08-18T00:12:00Z2015-08-18T00:24:00Z之间的原始数据,但不包括上限。
Group query results into 12 minutes intervals and by a tag key

> SELECT COUNT("water_level") FROM "h2o_feet" WHERE time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:30:00Z' GROUP BY time(12m),"location"

name: h2o_feet
tags: location=coyote_creek
time                   count
----                   -----
2015-08-18T00:00:00Z   2
2015-08-18T00:12:00Z   2
2015-08-18T00:24:00Z   2

name: h2o_feet
tags: location=santa_monica
time                   count
----                   -----
2015-08-18T00:00:00Z   2
2015-08-18T00:12:00Z   2
2015-08-18T00:24:00Z   2

查询使用InfluxQL函数计算water_level点的数量。它按location标签将结果分组,并以12分钟为间隔。注意,时间间隔和标记键在GROUPBY子句中用逗号分隔。
查询返回两系列结果:location标记的每个标记值一个。每个时间戳的结果表示一个12分钟的间隔。第一个时间戳的计数包括2015-08-18T00:00:00Z2015-08-18T00:12:00Z之间的原始数据,但不包括后者在内;第二个时间戳的计数包括2015-08-18T00:12:00Z2015-08-18T00:24:00Z之间的原始数据,但不包括后者在内。
Common issues with basic syntax
查询结果中意外的时间戳和值
使用基本语法,infloxdb依赖于GROUP BY time()间隔和系统预设的时间边界来确定每个时间间隔中包含的原始数据和查询返回的时间戳。在某些情况下,这可能会导致意想不到的结果。
例如:
RAW data:

> SELECT "water_level" FROM "h2o_feet" WHERE "location"='coyote_creek' AND time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:18:00Z'
name: h2o_feet
--------------
time                   water_level
2015-08-18T00:00:00Z   8.12
2015-08-18T00:06:00Z   8.005
2015-08-18T00:12:00Z   7.887
2015-08-18T00:18:00Z   7.762

以下查询包含12分钟的时间范围,并将结果分组为12分钟的时间间隔,但它返回两个结果:

> SELECT COUNT("water_level") FROM "h2o_feet" WHERE "location"='coyote_creek' AND time >= '2015-08-18T00:06:00Z' AND time < '2015-08-18T00:18:00Z' 
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值