Welcome Guest, Not a member yet? Register   Sign In
How to get data from 2 related tables in the same controller?
#3

PHP Code:
$this->db->select('d.*, o.*')
->
from('departments d')
->
join('occupations o''o.department_id = d.department_id''LEFT'


Simple join it is all you have to do, and you should learn JOIN clause in SQL.
Reply


Messages In This Thread
RE: How to get data from 2 related tables in the same controller? - by neuron - 07-09-2019, 11:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB