| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: How to find Brothers and Sisters?
> Just for sisters...
> 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'
> and P2.sex='Female'
When I try to run the above query in Access, I get the following message: "Syntax error (missing operator) in query expression P2.id = link.parent inner join .... P2.id = B.id"
What am I doing wrong? Below is the query for john's sisters that executes ok.
SELECT P2.name
FROM ((person INNER JOIN link ON person.id = link.child)
INNER JOIN link AS link2 ON link.parent = link2.parent)
INNER JOIN person AS P2 ON link2.child = P2.id
WHERE (((P2.name)<>"John")
AND ((person.name)="John")
AND ((P2.sex)="Female"));
person
id name sex
1 Adam Male
2 John Male
3 Jack Male
4 Mary Female
link
parent child
Adam John
Adam Jack
Adam Mary
Received on Sat Dec 02 2006 - 11:19:41 CST
![]() |
![]() |