2015-01-06 81 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;'找到版本号' –