0

所以这就是我要解决的问题。

Category(CatID(PK), CatName,....)
Writer(wtrID(PK), CatID(FK), wtrName,....)
Report(rpID(PK), title)
Authors(rpID(FK),wtrID(FK))

如何创建一个列表来显示来自 3 个不同类别的作者的报告标题?

4

1 回答 1

3
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
于 2012-08-02T10:28:09.963 回答