我对如何为这种情况制作 sql 语句感到非常困惑。我一直在尝试,但没有运气,所以希望有人能提供帮助。我有 3 个表:表 PARENTS、表 CHILDREN 和表 SCHOOL
-PARENTS has
ID name
-Children has
ID parentID nam
-SCHOOL has
ID parentID chidrenID schoolType
我想要的是让所有父母带着他们的孩子(无论他们是否上学)但是如果他们上学了,那么我需要 schoolType 是“highschool”
所以沿着这些思路(伪代码):
Select * from parents,children
where parents.ID = Children.parentID and
include school information
where parents.ID = school.parentID and
children.ID = school.childrenID and schoolType = "HighSchool"
有什么帮助???