I have two tables : courses
and courses_partners
. In table courses I have features of particular course and also field "public". In courses_partners I have course_id
, partner_id
, which are foreign keys (relation for M:N). I want to set "public" field in courses table to "n" when count of rows in courses_partners
where course_id=1
(for example) is maxAmount
(what is read from database :
SELECT maxAmount FROM courses WHERE course_id=1
for example. I have to do it in mysql database with trigger.