如何使用Join | codeigniter | sql |

I am trying to use the join to match 2 tables

I have the table user_to_designment

And

I have the table users

I want to match the table on user_id (They both have that value) I tried multiple ways to do that.

This is my code now:

$this->codeignitercrud->join ( 'join', 'user_to_designment', 'user_id' 'user_to_designment.user_id=username.user_id'  );

But this code gives me a error.

I use codeigniter crud system:http://demo.code-abc.com/codeignitercrud/help/index.html

I hope you guys can help me.

Kind regards,

Sterrek

 $this->db->select('*');
    $this->db->from(FIRST TABLE NAME);
    // IF Field name is common in both table use this way 
    $this->db->join_using(SECOND TABLE NAME,'FIELD NAME');
    //other wise 
    $this->db->join(SECOND TABLE NAME,'1st table FIELD NAME=2nd table Field name');    
     $query = $this->db->get();

Can you please use below code

$this->db->select("b.user_id); $this->db->from('username as b'); $this->db->join('user_to_designment as bo','bo.user_id=b.user_id',inner);

this->db->select('*');
    $this->db->from('A');
    $this->db->join('B','B.client_id=A.client_id');


    $result=$this->db->get();
    return $result->result();