$this->db->select('p.id, p.photo, p.desc, info.desc'); $this->db->from('products as p'); $this->db->join('lang_info as info', 'info.id=p.id and info.lang='.$this->lang, 'left'); $this->db->where('p.id', $this->product_id); $this->db->where_in('info.name', ['good', 'bad']);
Here is what the above code is Doing:
1. Selecting the id, photo, and desc fields from the products table.
2. Selecting the desc field from the lang_info table.
3. Joining the lang_info table to the products table on the id and lang fields.
4. Filtering the results by the product_id and lang fields.
5. Filtering the results by the name field in the lang_info table.