parent childs example apply on one to many relationship

parent childs example apply on one to many relationship

SarbastSarbast Posts: 85Questions: 0Answers: 0

I applied the parent childs example on my tables (colleges and depts) and it is work fine, the tables schema is as follow:

-Table "colleges"
--Fields: id, college_name
-Table "depts"
--Fields: id, dept_name, college_id
But the problem with the above schema is the duplication in the "depts" table, so I would like to change the schema to stop duplication in that table as follow
-Table "colleges"
--Fields: id, college_name
-Table "depts"
--Fields: id, dept_name
-Table "college_dept"
--Fields: college_id, dept_id
Then apply it on the parent childs example as here
https://datatables.net/blog/2019-01-11
Need your help and thanks

Replies

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin

    It sounds like a left join is the way to go here. Then have a separate page or DataTable for the departments.

    Allan

  • SarbastSarbast Posts: 85Questions: 0Answers: 0

    Thanks Allan
    I will try it

This discussion has been closed.