Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: How to find Brothers and Sisters?

Re: How to find Brothers and Sisters?

From: Cimode <cimode_at_hotmail.com>
Date: 2 Dec 2006 12:15:25 -0800
Message-ID: <1165090525.771966.195740@l12g2000cwl.googlegroups.com>

Neo a écrit :

> > 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"));
>
>

Forgot to mention that the query I provided is SQL Server compliant .I do not think Access does JOIN on selects. You may need to package the inner select in a view then do a JOIN on that view... Received on Sat Dec 02 2006 - 14:15:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US