I use Interbase 6 SQLServer in conjunction with Delphi 6 Enterprise.
I have a FATHER (Master), CHILD (Detail), GCHILD (Detail), GGCHILD (Detail) relationship.
I find (Example 1) below works perfectly. But Examples 2 and 3 do not.
Can someone please tell me what I am doing wrong?
Example 2 provides any and all GRANDCHILDREN who have a join to a CHILD and FATHER.
Example 3 provides any and all GREATGRANDCHILDREN who have a join to a GRANDCHILD, CHILD
and FATHER.
which is (of course) ALL of them and is not what I want.
What I want is:
In Example 2 when POINTING to (say) FATHER 2 and (his) CHILD 3 at any given moment I want
ONLY the GRANDCHILDREN of FATHER 2 and CHILD 3.
Equally When POINTING to (say) FATHER 3, (his) CHILD 2 and GRANDCHILD 1 at a given moment
I want to see ONLY the GREAT-GRANDCHILDREN of FATHER 3, CHILD 2 and GRANDCHILD 1.
EXAMPLE 1
select *
from CHILD t1, FATHER t2
where t1.P_NO = t2.P_NO
EXAMPLE 2
select *
from GCHILD t1, CHILD t2, FATHER t3
where (t1.P_NO = t3.P_NO) AND (t1.C_NO = t2.C_NO)
EXAMPLE 3
select *
from GGCHILD t1, GCHILD t2, CHILD t3, FATHER t4
where (t1.P_NO = t4.P_NO) AND (t1.C_NO = t2.C_NO) AND (t1.GC_NO = t3.GC_NO)
Thanks in advance