2017-12-10 7 views
0

primary keyname와의 관계 person(name, gender, father, mother)을 감안할 때, 그리고 gender 내가 차 모든 자매를 언급 목록을 Fi에 에서 재귀 전망 쓰기 어떻게, 값 MF에 복용?쿼리 Recusive보기

+0

어떤 [DBMS] (https://en.wikipedia.org/wiki/DBMS) 제품을 사용하고 있습니까? 포스트그레스? 신탁? "SQL"은 쿼리 언어 일뿐 특정 데이터베이스 제품의 이름은 아닙니다. –

+0

수백 가지 답변 [여기] (https://stackoverflow.com/questions/tagged/recursive-query+sql)은 어떻게됩니까? –

답변

0

자매의 정의가 양쪽 부모가 동일하다는 것을 의미한다고 가정하면, 이렇게 간단 할 수 있습니까?

select t2.name 
from table t1 join table t2 on t1.mother = t2mother 
and t1.father = t2.father 

where t1.name <> t2.name 
and t2.gender = 'F'