Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这些桌子
AssigenmentList--linksto --- School,AgeGroup
AssigenmentList
School
AgeGroup
Users将birthday依附于它
Users
birthday
one to many
现在我希望所有与特定学校链接的作业列表与孩子的年龄相同
作为基本规则:
select a.*, b.*, c.* from A a inner join B b on a.idB = b.id inner join C c on b.idC = c.id
您使用inner joinif a.idBmust have match 将行添加到结果集中。如果仅存在a.idB(左侧)就足以投影该行,则为左外连接。
inner join
a.idB
诀窍是从起始表导航到最后一个连接它们的列。