where('`' . $this->_tableAlias . '`.`show` = ?', 'y'); if (!empty($this->_year)){ $select->where('DATE_FORMAT(`published`, \'%Y\') = ?', $this->_year, Zend_Db::INT_TYPE); } elseif ($this->hasFilter()) { $subselect = $this->db->select(); $subselect->from($this->pair, 'MIN(DATE_FORMAT(`published`, \'%Y\'))'); $select->where('DATE_FORMAT(`published`, \'%Y\') = (' . $subselect . ')'); } return $select; } }