SQL one to many?
So this is the problem I am trying to solve.
Category(CatID(PK), CatName,....) Writer(wtrID(PK), CatID(FK), wtrName,....) Report(rpID(PK), title) Authors(rpID(FK),wtrID(FK))
how can I create a list to show the title of the Reports with Authors that come from exactly 3 different categories ?
select r.title, group_concat(w.wtrID) as writer_ids from Reports r inner join Authors a on a.rpID = r.rpID inner join Writer w on w.wtrID = a.wtrID inner join Category c on c.CatID = w.CatID group by r.title having count(distinct c.CatID) = 3