2015-01-06 82 views
2

您可以使用distinct()方法添加「DISTINCT」。但添加後有沒有辦法將其刪除?從Zend_Db_Select中刪除「DISTINCT」

+0

? –

+0

@NandakumarV我不確定哪個版本,但我的'distinct()'方法看起來與你發佈的相同。文件版本是:'@version $ Id:Select.php 23254 2010-10-26 12:49:23Z matthew $' –

回答

4

該方法接受參數$flag(bool)。將其設置爲false將從查詢中禁用截然不同的。檢查

的Zend/DB/Select.php線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這是Zend的1.12是否使用的是Zend的版本

+0

非常好!謝謝。這看起來像會起作用。 –

+0

@ButtleButkus你可以使用'echo Zend_Version :: VERSION;'找到版本號' –