Multiple SQL Joins from same table with Codeigniter

前端 未结 2 1064
深忆病人
深忆病人 2021-01-05 21:46

I have a DB with 2 columns of ID that reference the same table

How do I do 2 joins to the same table, and be able to pull the data.

Here is what I have:

相关标签:
2条回答
  • 2021-01-05 22:19
    $this->db->select('*');
        $this->db->from('jobs');
        $this->db->join('company','company.cmp_name = jobs.cmp_name');
        $this->db->where('company.location', $data['location']);**strong text**
    
    0 讨论(0)
  • 2021-01-05 22:37

    Just alias it differently:

    $this->db->join('instructors as ialt', 'ialt.id = s._alt_instructor_id');
    
    0 讨论(0)
提交回复
热议问题