TL;DR
I am asking for assistance filtering out and deleting just students of specific year groups?
Long version:
I am building a demo for a system with 6 year groups. I have successfully renamed the existing demo year groups by editing the gibbonYearGroup table. However, I am having challenges deleting the students that are in “Year 13” of the demo.
I have run the following: select * from gibbonPerson where gibbonRoleIDPrimary=003.
Although I do filter out students, the only other field (in the gibbonPerson table) that I can filter students by here is the gibbonHouse.
There is no gibbonYearGroupID, or Form group-related field in the gibbonPerson table.
In a way, I am trying to understand how Students are linked to Year Groups :/.
Students are enrolled in the current school year through the gibbonStudentEnrolment table, which connects a gibbonPerson record to a gibbonSchoolYearID, gibbonYearGroupID and gibbonFormGroupID. To delete all students of a particular year group you’d want to do a table join with the gibbonStudentEnrolment table. Here is an example, replace the year group ID and school year ID as needed:
`DELETE gibbonPerson FROM gibbonPerson
JOIN gibbonStudentEnrolment ON (gibbonStudentEnrolment.gibbonPersonID=gibbonPerson.gibbonPersonID)
WHERE gibbonStudentEnrolment.gibbonSchoolYearID=025
AND gibbonStudentEnrolment.gibbonYearGroupID=007
AND gibbonPerson.gibbonRoleIDPrimary=003;`
```
I would have not have figured out how these tables are linked on my own…lol. Thanks for adding the correct IDs in the ‘example’ script above. It worked very well. Thanks for the amazing response times.