Vigneshrajkumar Vigneshrajkumar - 1 month ago 8
MySQL Question

How to include the 2 query data into single result?

I had 2 queries like this

Query 1

$this->db->select('*');
$this->db->from('transaction_log');
$this->db->join('crs_hotel_booking_details', 'transaction_log.app_reference = crs_hotel_booking_details.app_reference');
$this->db->join('crs_hotel_supplier_details', 'crs_hotel_booking_details.hotel_id = crs_hotel_supplier_details.hotel_id');
$this->db->join('crs_supplier_login', 'crs_supplier_login.supplier_id = crs_hotel_supplier_details.supplier_id');
$this->db->where('crs_supplier_login.supplier_id',$this->entity_user_id);
$query = $this->db->get();


Query 2

$this->db->select('*');
$this->db->from('transaction_log');
$this->db->join('service_booking_details', 'transaction_log.app_reference = service_booking_details.app_reference');
$this->db->join('crs_service_supplier_details', 'service_booking_details.service_apartment_id = crs_service_supplier_details.service_apartment_id');
$this->db->join('crs_supplier_login', 'crs_supplier_login.supplier_id = crs_service_supplier_details.supplier_id');
$this->db->where('crs_supplier_login.supplier_id',$this->entity_user_id);
$query = $this->db->get();


I got the values in both queries. Please tell me how add this two queries

Answer

just as,

array_merge($query1->result_array(), $query2->result_array());
Comments