php - combining output of a query -
i fetching data 3 tables of join. output in json format.
output in json format:-
{"order_id":"2","location_address":"testing location delhi","emp_first_name":"ranjeet","order_status":"0","from_date":"0000-00-00 00:00:00","actions":"\r\n </i> edit </a>\r\n \r\n </i> delete </a>"},
{"order_id":"2","location_address":"testing location delhi","emp_first_name":"abhijeet","order_status":"0","from_date":"0000-00-00 00:00:00","actions":"\r\n </i> edit </a>\r\n \r\n </i> delete </a>"},
the problem is, in above output, data same emp_first_name different because both having seperate id's. want combine data of both emp_first_name , display single output like
the output want :-
{"order_id":"2","location_address":"testing location delhi","emp_first_name":"ranjeet,abhijeet","order_status":"0","from_date":"0000-00-00 00:00:00","actions":"\r\n </i> edit </a>\r\n \r\n </i> delete </a>"},
query used :-
$this->datatables->select('o.order_id, concat_ws(" " , `l.location_street`, `l.location_city` ) location_address, e.emp_first_name, o.order_status, o.from_date') ->from('orders o') ->join('location l', 'o.location_id = l.location_id') ->join('order_details od', 'od.order_id = o.order_id') ->join('employee e', 'e.emp_id = od.emp_id');
any appreciated. thank in advance.
Comments
Post a Comment