我在模型中有一个查询:
public function loadPerform(){
$select = $this->select()
->from(array('p' => $this->_tables['performance']))
->join(array('phc' => $this->_tables['perf_has_component']), 'phc.performance_id=p.performance_id', array('*'), 'left');
//echo str_replace('"','',$select->getSqlString())."<br />";
return $this->fetchAll($select);
}
结果是:
Array([0]=>Array(
[performance_id]=>
[title]=>Performance11
[description]=>haha
[create_dtm]=>2016-04-0500: 14: 54
[create_by]=>90141063
[phc_id]=>
[last_update_dtm]=>
[update_by]=>
))
它有效,但它没有在结果中显示 performance_id
。我的查询有什么问题??谢谢
最佳答案
请修改您的查询:
$select = $this->select()
->from(array('p' => $this->_tables['performance']),array('performance_id'))
->join(array('phc' => $this->_tables['perf_has_component']), 'phc.performance_id=p.performance_id', array('*'), 'left');
关于php - ZF2 查询结果不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36416652/