如何打开此左连接查询:
select advertisercontest.*,advertiseraccount.advertiserid,advertiseraccount.companyname from advertisercontest left join advertiseraccount on advertiseraccount.loginid = advertisercontest.loginid where advertisercontest.golive is not NULL;
进入Zend的左连接?
解决方法
你可以这样做:
$db = Zend_Db_Table::getDefaultAdapter(); $select = $db->select(); $select->from('advertisercontest','*') ->joinLeft( 'advertiseraccount','advertiseraccount.loginid = advertisercontest.loginid',array('advertiseraccount.advertiserid','advertiseraccount.companyname') ) ->where('advertisercontest.golive is not NULL');; $result = $db->fetchAll($select); var_dump($result);
希望没关系.