Issue Bug New Orphaned

#94899Exbase: Expression #1 of ORDER BY clause is not in SELECT list

Alex Kellner 08/16/21, 11:00 updated 09/18/25, 08:41

Description

TYPO3 10.4.19
MySQL 5.7.35

When I do an individual Query in my Repository with an order_by to a related table field, an error like:

Expression #1 of ORDER BY clause is not in SELECT list, references column 'typo3.tx_lux_domain_model_pagevisit.tstamp' which is not in SELECT list; this is incompatible with DISTINCT

came up

Example function in a Repository:

    public function findSomething(): QueryResultInterface
    {
        $query = $this->createQuery();
        $query->setOrderings(['relatedTable.tstamp' => QueryInterface::ORDER_DESCENDING]);
        return $query->execute();
    }

When I do a “select SQL_MODE;” – this is the definition:

ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Exbase: Expression #1 of ORDER BY clause is not in SELECT list Resolves: #94899 Releases: main