根据在选择()的Zend/DB /表/ Abstract.php,它检查是否包含从部分的,而不是获取字段名
/**
* Returns an instance of a Zend_Db_Table_Select object.
*
* @param bool $withFromPart Whether or not to include the from part of the select based on the table
* @return Zend_Db_Table_Select
*/
public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)
{
require_once 'Zend/Db/Table/Select.php';
$select = new Zend_Db_Table_Select($this);
if ($withFromPart == self::SELECT_WITH_FROM_PART) {
$select->from($this->info(self::NAME), Zend_Db_Table_Select::SQL_WILDCARD, $this->info(self::SCHEMA));
}
return $select;
}
看看下面的代码段可以帮助(用所需的一个替换table_name)
$select = $groupsmapper->getDbTable()
->select()
->distinct()
->from(array('table_name'), array('group_area_residence'));
$response = $groupsmapper->getDbTable()->fetchAll($select);
感谢这个伴侣,它的工作。我想知道,虽然不是getDbTable应该获取表名?如果是这样,为什么我需要在from部分再添加一个。无论如何非常感谢。 – Napoleon 2010-12-17 11:00:42