> ## 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`](/ja/reference/functions/aggregate-functions/maxIntersections) 関数の出現位置を算出する集約関数です。

**構文**

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

**引数**

* `start_column` — 各インターバルの開始を表す数値カラムです。`start_column` が `NULL` または 0 の場合、そのインターバルはスキップされます。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float)
* `end_column` — 各インターバルの終了を表す数値カラムです。`end_column` が `NULL` または 0 の場合、そのインターバルはスキップされます。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float)

**戻り値**

最も多くのインターバルが重なっている開始位置を返します。[`Any`](/ja/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 │
└──────────────────────────────────────┘
```
