MysQL UNION in Zend Framework


$selectQry1 = $this->db->select()->from(array('F'=>$tableName))
        ->join(array('FA'=>$tableName2),
        'FA.form_id=F.form_id',
        array('association_id','association_type', 'object_id'))
        ->where('FA.association_type = ?','user')
        ->where('FA.object_id = ?',mysql_escape_string($this->_userId));   
$selectQry2 = $this->db->select()->from(array('F'=>$tableName))
        ->join(array('FA'=>$tableName2),
        'FA.form_id=F.form_id',
        array('association_id','association_type', 'object_id'))
        ->where('FA.association_type = ?','group')
        ->where('FA.object_id IN ( ? )',$groups);   
$selectQry = $this->db->select()->union(array($selectQry1, $selectQry2), Zend_Db_Select::SQL_UNION_ALL)
         ->group('form_id');