如何在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
);