I have 2 join queries. I need to union them together. Both of the join queries have a new field say 'str_type'.
I need to make this NULL at for one join and some value in other join which is not making me possible?
$config = Zend_Registry::get('config');
$tablePrefix = $config->resources->db->Params->tablePrefix;
$accidentDetailes1= $this-> getDbTable()->select()
->setIntegrityCheck(false)
->setIntegrityCheck(false)
->from(array("va"=>$tablePrefix."tbl_veh_accident"),"*")
->joinLeft(array("ve"=>$tablePrefix."tbl_veh_accident_est"),"va.pk_bint_veh_accident_id=ve.fk_bint_veh_accident_id AND ve.chr_document_status='N'",array("dat_send","vchr_estimated_by","dbl_amount","dat_received","1"=>"str_type","bint_year"=>NULL))
$accidentDetailes2= $this-> getDbTable()->select()
->setIntegrityCheck(false)
->from(array("va"=>$tablePrefix."tbl_veh_accident"),"*")
->joinLeft(array("ve"=>$tablePrefix."tbl_veh_accident_est"),"ve.fk_bint_veh_accident_id=va.pk_bint_veh_accident_id AND ve.chr_document_status='N'",array(
"dat_send",
"vchr_estimated_by",
"dbl_amount",
"dat_received",,"2"=>"str_type"
))
->joinLeft(array("vm"=>$tablePrefix."tbl_veh_master"),"vm.pk_bint_veh_master_id=va.fk_bint_veh_master_id",array("bint_year"))
$accidentDetailes = $this->getDbTable()->select()->union(array($accidentDetailes1, $accidentDetailes2));
Here str_type is defined as 1 in first join and 2 in second join respectively. Also bint_year is defined as NULL in first join and some value is setin second table respectively.
But not getting the expected result. It says that NULL is not defined. How can I fix this?