L
L
Lavrov952019-01-14 21:51:25
Zend Framework
Lavrov95, 2019-01-14 21:51:25

How to write correct join min value in zend?

Error Statement could not be executed (HY000 - 1111 - Invalid use of group function)

$select->join(
        DbTables::TBL_APARTMENT_IMAGES,
        new Expression(
            DbTables::TBL_APARTMENT_IMAGES . '.apartment_id = ' . $this->getTable() . '.id AND MIN(' .
            DbTables::TBL_APARTMENT_IMAGES . '.image_order)'
        ),
        [
            'image_path',
        ],
        Select::JOIN_LEFT
    );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question