Connecting Tech Pros Worldwide Help | Site Map

SQL Query question

andi
Guest
 
Posts: n/a
#1: Nov 12 '05
Hi All,
I have a table consists of two fields.

FielChild FieldParent
B1 B2
B2 B3
B3 Null

means that B3 is the parent of B2 & B1
and B2 is the parent of B1, and B1 has no child.

what I need is an sql query that can display the children of B1, B2, and B3.
e.g the result for B3 should look like:

Parent Child
B3 B3
B3 B2
B3 B1
B2 B2
B2 B1
B1 B1

TIA,
andi
Larry Linson
Guest
 
Posts: n/a
#2: Nov 12 '05

re: SQL Query question


In the Query Builder, include the same table as many times as the
generations you want to have/show, then join it to itself ("self-join"), one
copy after the other. Let the Query Builder generate the SQL for you.

Larry Linson
Microsoft Access MVP

"andi" <andihp2@yahoo.com> wrote in message
news:5680ea0b.0405052335.63520828@posting.google.c om...[color=blue]
> Hi All,
> I have a table consists of two fields.
>
> FielChild FieldParent
> B1 B2
> B2 B3
> B3 Null
>
> means that B3 is the parent of B2 & B1
> and B2 is the parent of B1, and B1 has no child.
>
> what I need is an sql query that can display the children of B1, B2, and[/color]
B3.[color=blue]
> e.g the result for B3 should look like:
>
> Parent Child
> B3 B3
> B3 B2
> B3 B1
> B2 B2
> B2 B1
> B1 B1
>
> TIA,
> andi[/color]


Closed Thread


Similar Microsoft Access / VBA bytes