Join 在使用zend框架连接表之后,它只显示一个表字段

Join 在使用zend框架连接表之后,它只显示一个表字段,join,zend-framework,field,show,Join,Zend Framework,Field,Show,我有两个表product\u category和product\u sub\u category 字段的名称相同(id、名称、解释、优先级) product\u sub\u category具有指向product\u category表的外键,该表具有asproduct\u category\u id 在下面的代码中,我看到的是product\u category字段 $select = $this->select("t1.* , t2.*") ->setIntegrityChe

我有两个表
product\u category
product\u sub\u category

字段的名称相同(id、名称、解释、优先级)

product\u sub\u category
具有指向
product\u category
表的外键,该表具有as
product\u category\u id

在下面的代码中,我看到的是
product\u category
字段

$select = $this->select("t1.* , t2.*")
  ->setIntegrityCheck(false)
  ->from(array("t1"=>$this->_name))
  ->joinInner(array("t2"=>'product_category'), 't2.id = t1.product_category_id')
  ->order(array('t1.priority'));
$res = $this->fetchAll($select);
return $res;
$this->\u name
中,变量应为字符串
产品子类别


为什么我不能看到两个表中的所有字段?

MySQL将返回同名字段,因此当ZF将它们转换为使用名称作为索引的数组时,后者将覆盖第一个字段。您需要为他们提供别名:

$this->select("t1.name AS category_name, t1.explain AS category_explain, t2.name AS subcategory_name")
等等