Sentry Issue: [POSTHOG-36X](https://sentry.io/organizations/posthog/issues/2508108850/?referrer=github_integration)

ee/clickhouse/queries/funnels/base.py
cols: List[str] = []
        for i in range(0, max_steps):
            cols.append(f"step_{i}")
            if i < level_index:
                cols.append(f"latest_{i}")
            else:
                duplicate_event = 0
                if i > 0 and self._filter.entities[i].equals(self._filter.entities[i - 1]):
                    duplicate_event = 1
                cols.append(
                    f"min(latest_{i}) over (PARTITION by person_id {self._get_breakdown_prop()} ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND {duplicate_event} PRECEDING) latest_{i}"
                )
        return ", ".join(cols)
    def _get_comparison_at_step(self, index: int, level_index: int):
        or_statements: List[str] = []
        for i in range(level_index, index + 1):
            or_statements.append(f"latest_{i} < latest_{level_index - 1}")
        return " OR ".join(or_statements)
    def _get_sorting_condition(self, curr_index: int, max_steps: int):
        if curr_index == 1:
            return "1"
        conditions: List[str] = []
        for i in range(1, curr_index):
            conditions.append(f"latest_{i - 1} < latest_{i }")
            conditions.append(f"latest_{i} <= latest_0 + INTERVAL {self._filter.funnel_window_days} DAY")
        return f"if({' AND '.join(conditions)}, {curr_index}, {self._get_sorting_condition(curr_index - 1, max_steps)})"
    def _get_inner_event_query(