select('t.id, t.title, t.write_off_date, tlog.note') ->from(\app\models\entity\Tmc::tableName() . ' t') ->leftJoin(\app\models\entity\Log::tableName() . ' tlog', 'tlog.tmc = t.id') ->where('t.status = ' . \app\models\entity\TmcStatus::TMC_STATUS_DECOMMISSION) ; $devices = $query->all(); ?>