从 Zend_Db_Select 中删除 "DISTINCT"

Remove "DISTINCT" from Zend_Db_Select

您可以使用 distinct() 方法添加 "DISTINCT"。但是添加之后有什么办法去掉吗?

distinct 方法接受参数 $flag(bool)。将其设置为 false 将从查询中禁用 distinct。检查

Zend/Db/Select.php Line 192

/**
     * Makes the query SELECT DISTINCT.
     *
     * @param bool $flag Whether or not the SELECT is DISTINCT (default true).
     * @return Zend_Db_Select This Zend_Db_Select object.
     */
    public function distinct($flag = true)
    {
        $this->_parts[self::DISTINCT] = (bool) $flag;
        return $this;
    }

注意这是针对 Zend 1.12