how to prepare subquery in zend framework
I want to prepare a subquery like this in zend framework:
select * from dept_view
where
(
(select sum(开发者_如何学Gosal) from emp where emp_id IN (10,11))
&
dept_sal
)
any ideas ?
Thanks,
Something like this should work:
$subSelect = $db->select();
$subSelect->from('emp', array('SUM(sal)'))
->where('emp_id IN (?)', array(10,11));
$select = $db->select();
$select->from('dept_view')
->where($subSelect);
精彩评论