Re: How to find Brothers and Sisters?

From: Cimode <>
Date: 2 Dec 2006 05:28:34 -0800
Message-ID: <>

<<<<What schema/query finds John's brothers and sisters based only on direct relationships to parent and gender>>>>

Something like this should do...

SK: Suroggate key

name+sex uniquely identifies person

nodes: id(SK), name, sex

1(SK), Adam, Male
2(SK), John, Male
3(SK), Jack, Male
4(SK), Mary, Female

link:parent(FK), child(FK)
parent, child

1, 2
1, 3
1, 4

Getting John's brother and sisters without involving Adam in da query

select, from person P2
	inner join link
		on = link.parent
	inner join (select id from link inner join person P1 on child = where = 'Jonh') B
		on =

where <> 'John'

) Received on Sat Dec 02 2006 - 14:28:34 CET

Original text of this message