I have one table and I'm trying to implement overlapping time for a teaching and learning activity. I have created a table named order_learn the contents of the field is ID (int, auto increment), id_user (varchar), material_id (varchar), start_periode (date), end_periode (date), generation (varchar), totalday (varchar), remarks (text).
a student can take any subject whose learning hours are determined by the start_period (date) and end_periode (date), generation (varchar).
which students are not allowed to take on subjects that coincide with other lessons (overlap on lesson dates).
1 2 1 03/01/2017 03/13/2017 I 10 (return true for the first record)
2 2 2 03/01/2017 03/13/2017 I 10 ( return true if record existing)
3 2 2 03/15/2017 03/21/2017 II 10 (return true becouse the new record not overlap with other record by date ).......etc
4 2 5 03/08/2017 03/17/2017 III 10 (return false because the record is date overlap with other record)
from the above data shows that id_user takes 4 subjects with the same time that should not be allowed by the system later unless the schedule of the lesson is in the second generation with the implementation time above 21/13/2017.
1. how do I make a condition if a student wants to take 3 subjects whose time has certainly not overlapped based on a predetermined schedule (condition)?
3. how to script it?
so my question, for your help I thank you.