> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8c05c8a2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 计算 maxIntersections 函数各次出现位置的聚合函数。

# maxIntersectionsPosition

<div id="maxIntersectionsPosition">
  ## maxIntersectionsPosition
</div>

首次引入于：v1.1.0

用于计算 [`maxIntersections`](/zh/reference/functions/aggregate-functions/maxIntersections) 函数各次出现位置的聚合函数。

**语法**

```sql theme={null}
maxIntersectionsPosition(start_column, end_column)
```

**参数**

* `start_column` — 表示每个区间起点的数值列。如果 `start_column` 为 `NULL` 或 0，则跳过该区间。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float)
* `end_column` — 表示每个区间终点的数值列。如果 `end_column` 为 `NULL` 或 0，则跳过该区间。[`(U)Int*`](/zh/reference/data-types/int-uint) 或 [`Float*`](/zh/reference/data-types/float)

**返回值**

返回相交区间数量最多时的起始位置。[`Any`](/zh/reference/data-types/index)

**示例**

**查找相交数量最多的位置**

```sql title=Query theme={null}
CREATE TABLE my_events (
    start UInt32,
    end UInt32
)
ENGINE = MergeTree
ORDER BY tuple();

INSERT INTO my_events VALUES
(1, 3),
(1, 6),
(2, 5),
(3, 7);

SELECT maxIntersectionsPosition(start, end) FROM my_events;
```

```response title=Response theme={null}
┌─maxIntersectionsPosition(start, end)─┐
│                                    2 │
└──────────────────────────────────────┘
```
