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

> Aggregate function that calculates the positions of the occurrences of the maxIntersections function.

# maxIntersectionsPosition

<h2 id="maxIntersectionsPosition">
  maxIntersectionsPosition
</h2>

Introduced in: v1.1.0

Aggregate function that calculates the positions of the occurrences of the [`maxIntersections`](/reference/functions/aggregate-functions/maxIntersections) function.

**Syntax**

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

**Arguments**

* `start_column` — A numeric column that represents the start of each interval. If `start_column` is `NULL` or 0 then the interval will be skipped. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float)
* `end_column` — A numeric column that represents the end of each interval. If `end_column` is `NULL` or 0 then the interval will be skipped. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float)

**Returned value**

Returns the start positions of the maximum number of intersected intervals. [`Any`](/reference/data-types/index)

**Examples**

**Finding maximum intersections position**

```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 │
└──────────────────────────────────────┘
```
