Re: How to find Brothers and Sisters?

From: Neo <neo55592_at_hotmail.com>
Date: 2 Dec 2006 08:02:29 -0800
Message-ID: <1165075349.708433.245820_at_16g2000cwy.googlegroups.com>


> Getting John's brother and sisters without involving Adam in da query
> -------------------------------------------------------------------------
> select P2.name, P2.sex
> from person P2 inner join link on P2.id = link.parent
> inner join (select id from link inner join person P1
> on child = person.id where person.name = 'John') B
> on P2.id = B.id
> where P2.name <> 'John'

Thx. I am having trouble determining if our solutions in RMDB/SQL are equivalent. I have verified the following in MS Access. Are they equivalent? (I realize above query is for brothers and sisters where as the following is just for brothers)

SELECT P2.name
FROM ((person INNER JOIN link ON person.ID = link.childID) INNER JOIN link AS link2 ON link.parentID = link2.parentID) INNER JOIN person AS P2 ON link2.childID = P2.ID WHERE (((P2.name)<>"John")

             AND ((person.name)="John")
             AND ((P2.sex)="Male"));
Received on Sat Dec 02 2006 - 17:02:29 CET

Original text of this message