---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - >-
    en/datalens/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN-TABLE_NOT_SORTED.md
  - >-
    en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN-TABLE_NOT_SORTED
  - >-
    ru/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN-TABLE_NOT_SORTED
  - href: >-
      en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN-TABLE_NOT_SORTED.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-TABLE_NOT_SORTED.html
title: >-
  DataLens On-premises error:
  ERR.DS_API.DB.CHYT.INVALID_SORTED_JOIN.TABLE_NOT_SORTED
description: This page describes the `Tables should be sorted` DataLens On-premises error.
vcsPath: >-
  en/troubleshooting/errors/ERR-DS_API-DB-CHYT-INVALID_SORTED_JOIN-TABLE_NOT_SORTED.md
---

# [DataLens On-premises] Tables should be sorted

`ERR.DS_API.DB.CHYT.INVALID_SORTED_JOIN.TABLE_NOT_SORTED`

This error occurs when one of the tables in a sorted JOIN is not sorted. The detailed error message specifies the problematic table.

To fix this error, sort and save the table using an appropriate key, or use a pre-sorted table. If this is not possible, use a different JOIN strategy in your SQL query or prepare an intermediate source.
