[eluser]Unknown[/eluser]
I have 3 tables:
1. taskcategories (category_id, task_id) <-- this is a lookup table
2. categories (id, name) <-- this table lists all of my sites categories
3. tasks (id, description) <-- main table with tasks
I would like to retrieve all of the tasks that have the same category as my current task. My current task category is being passed into the function (see below).
I can't get it working.
Code:
function get_similar_tasks($category_id) {
return $this->db->select('task_id')
->from('taskcategories')
->where('category_id', $category_id)
//join tasks table where taskcategories.task_id=tasks.id
->get()->result();
}