Reputation: 1623
I realize that Zend DB, Left Join SQL query return NULL for the join column. Is this true?
For example:
$selectmatchedtime = $this->dbo->select()
->from(array('v'=>'table1'))
->joinLeft(array('vc'=>'table2'),'vc.vid = v.vid');
Return null for all vid...
Upvotes: 4
Views: 5706
Reputation: 106483
The problem is that vid
column in your query belongs to two tables, but obviously can store only a single value in the result set. To resolve the problem, make an alias for it, stating explicitly which table should be used:
$selectmatchedtime = $this->dbo->select()
->from(array('v'=>'table1'))
->joinLeft(array('vc'=>'table2'),'vc.vid = v.vid')
->columns(array('vid'=>'v.vid'));
Upvotes: 2