简体   繁体   中英

Remove “DISTINCT” from Zend_Db_Select

You can add "DISTINCT" with the distinct() method. But is there any way to remove it after it is added?

The distinct method accepts a parameter $flag(bool) . Setting it to false will disable the distinct from the query. Check

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;
    }

NB This is for Zend 1.12

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM