Buttle Butkus
Buttle Butkus

Reputation: 9466

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?

Upvotes: 2

Views: 148

Answers (1)

Nandakumar V
Nandakumar V

Reputation: 4625

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

Upvotes: 4

Related Questions