如何在zend中编写正确的连接最小值?

时间:2019-01-14 18:50:15

标签: zend-framework

如何在zend中编写正确的联接最小值?

无法执行错误语句(HY000-1111-无效使用组功能)

$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
    );

This code is working

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

0 个答案:

没有答案