我是zend 1.12的新手,我想构建以下查询,请建议:
SELECT tbl_user.first_name, tbl_user.last_name, tbl_user.email, tbl_user_group.group_id
FROM `tbl_user`, `tbl_user_group`
WHERE `organization_id` = 5
AND tbl_user.user_id = tbl_user_group.user_id
AND tbl_user_group.group_id = 11
答案 0 :(得分:0)
试试这个(未经测试):
$select = $db->select()
->from(array('tu' => 'tbl_user'),
array('first_name', 'last_name', 'email'))
->join(array('tug' => 'tbl_user_group'),
'tu.user_id = tug.user_id',
array('group_id'))
->where('tu.organization_id = ?', 5)
->where('tug.group_id = ?', 11);