_db->select(); $select->distinct(); $select->from($this->_getPair(), array('year' => 'DATE_FORMAT(`date`, "%Y")')); $select->order('year DESC'); return $select; } public function getYears4Select() { if (null === $this->_yearsList) { $select = $this->_getYearsSelect(); $list = $this->_db->fetchCol($select); if (!empty($list)) { $this->_yearsList = array_combine($list, $list); } else { $this->_yearsList = array(); } } return $this->_yearsList; } protected function _filter(Zend_Db_Select $select) { parent::_filter($select); if (!empty($this->_filter['year']) && array_key_exists($this->_filter['year'], $this->getYears4Select())) { $select->where('`' . $this->_tableAlias . '`.`date` LIKE ?', $this->_filter['year']. '%'); } return $this; } }