---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/datalens/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN.md
  - en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN
  - ru/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN
  - href: en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN.html
title: 'DataLens On-premises error: ERR.DS_API.DB.CHYT.INVALID_SORTED_JOIN'
description: This page describes the `Invalid sorted JOIN` DataLens On-premises error.
vcsPath: en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN.md
---

# [DataLens On-premises] Invalid sorted JOIN

`ERR.DS_API.DB.CHYT.INVALID_SORTED_JOIN`

Sorting error when joining tables in CHYT.

For a sorted JOIN, both tables must be sorted, and the `ON`/`USING` condition must use simple equalities to match identical prefixes of key columns.

To fix this error, try the following:

* Fix table sorting order or the join condition.
* For a SQL query, choose a different join strategy, e.g., `GLOBAL JOIN` or a subquery.
* For a dataset, create a junction table or SQL source.
