sql - Zend how do I create a left join -
how turn left join query:
select advertisercontest.*, advertiseraccount.advertiserid, advertiseraccount.companyname advertisercontest left join advertiseraccount on advertiseraccount.loginid = advertisercontest.loginid advertisercontest.golive not null;
into left join in zend?
you follows:
$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 not null');; $result = $db->fetchall($select); var_dump($result);
hope ok.
Comments
Post a Comment