Answers for "how to write orderby in join query with where clause in codeigniter"

PHP
0

how to write orderby in join query with where clause in codeigniter

public function getLatestStatus($data, $userid)
	{
		$this->db->select('
				S.shipment_id,
				S.added_on,
				S.waybill_number AS waybill,
				s_status_logs.updated_on,
				s_status_logs.status_location,
				s_status_logs.px_statuscode,
				s_status.status_title,
				s_status_logs.status_description AS remark,
				transitpartner_name
			');
		$this->db->from('shipments as S');
		$this->db->join('users', 'users.user_id=S.user_id', 'left');
		$this->db->join('master_transit_partners as mtp', 'mtp.transitpartner_id=S.fulfilled_by', 'left');
		$this->db->join('shipments_status_logs as s_status_logs', 's_status_logs.shipment_id=S.shipment_id', 'left');
		$this->db->join('shipments_status as s_status', 's_status.status_id=s_status_logs.px_statuscode', 'left');
		$this->db->where('S.waybill_number', $data);
		$this->db->or_where('S.shipment_id', $data);
		$this->db->where('S.user_id', $userid);
		$this->db->limit(1, 1);
    $this->db->order_by('S.shipment_id', 'desc');
		$query = $this->db->get();
		return $query->result_array();
	}
Posted by: Guest on September-17-2021

Code answers related to "how to write orderby in join query with where clause in codeigniter"

Browse Popular Code Answers by Language