_select) { return $this->_select; } $checkSelect = $this->_db->select(); $checkSelect->from($this->_getPair($this->_appFileTableAlias, 'Duplicate'), [new Zend_Db_Expr('1')]); $checkSelect->where("`Duplicate`.`id` != `{$this->_appFileTableAlias}`.`id`"); $checkSelect->where("`Duplicate`.`fileName` = `{$this->_appFileTableAlias}`.`fileName`"); $checkSelect->limit(1); $this->_select = $this->_db->select(); $this->_select->from($this->_getPair($this->_appFileTableAlias), $this->_getFromColumns()); $this->_select->where('EXISTS (' . $checkSelect . ')'); $this->_select->order('fileName'); return $this->_select; } }