CodeIgniter Forums
how to make self join in GroceryCRUD - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: how to make self join in GroceryCRUD (/showthread.php?tid=55643)



how to make self join in GroceryCRUD - El Forum - 11-05-2012

[eluser]webmasterminds[/eluser]
Hi..!

I have a table "books" and a column "books.tags"
i want to make a self join so tags should b display by click on the field
as it happens in "set_relation_n_n"
here is my query
Controller:

function book_managment()
{
$crud = new grocery_CRUD();

$crud->set_theme('datatables');
$crud->set_table('books');
$crud->set_relation_n_n('category', 'book_category', 'category', 'book_id', 'category_id', 'name');
$crud->unset_columns('tags','description');

$crud->required_fields('title', 'description' , 'category' ,'publish_year','length', 'rating');
$crud->set_field_upload('file','assets/uploads/files');
$output = $crud->render();

$this->output($output);
}

as i define set_relation_n_n so when i go to add a new record and click on "name" column of category table it show me all "category.name" same i want to do with book column here i want a self join.