Multiple Statements
更新时间:
复制 MD 格式
Separate multiple SELECT statements in a single query with a semicolon (;). Each statement runs independently, and the results are returned together.
Examples
CLI
The following example runs two SELECT statements in one command using the command-line interface (CLI) of TSDB for InfluxDB®.
> SELECT MEAN("water_level") FROM "h2o_feet"; SELECT "water_level" FROM "h2o_feet" LIMIT 2Output:
name: h2o_feet
time mean
---- ----
1970-01-01T00:00:00Z 4.442107025822522
name: h2o_feet
time water_level
---- -----------
2015-08-18T00:00:00Z 8.12
2015-08-18T00:00:00Z 2.064HTTP API
The response assigns a statement_id to each query result in the order the statements appear — 0 for the first statement, 1 for the second, and so on.
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "h2o_feet",
"columns": [
"time",
"mean"
],
"values": [
[
"1970-01-01T00:00:00Z",
4.442107025822522
]
]
}
]
},
{
"statement_id": 1,
"series": [
{
"name": "h2o_feet",
"columns": [
"time",
"water_level"
],
"values": [
[
"2015-08-18T00:00:00Z",
8.12
],
[
"2015-08-18T00:00:00Z",
2.064
]
]
}
]
}
]
}InfluxDB® is a trademark registered by InfluxData, which is not affiliated with, and does not endorse, TSDB for InfluxDB®.
该文章对您有帮助吗?