G
Guest
Hi all,
I have this long query that extract datas from 12 tables, in that main query
there are 8 subqueries, it work fine with pass-thru, but now this query need
to do as access query. I need to have all info from table1, and only info
from table2 which matched table1, only info from table3 which matched
table2....
Below is example of 4 tables only since I need to understand the way to
right subqueries with access on a multi-outer join,
Relationships:
Table1--->Table2--->Table3
|
v
Table4
Table1 fields: ID(primary key), code,Tb1_field2, Tb1_field3, Tb1_field4... etc
Table2 fields: ID(foreign key), seq_id, TB2_ID(FK to table 3), flag,
tb2_field1, tb2_field2 ...etc
table3 fields: TB3_ID(PK), tb3_field1,tb3_field2...etc
Table4 fileds: code(pk), code_desc
my pass-thru like this:
SELECT DISTINCT TABLE1.ID,TABLE1.Tb1_field2, TABLE1.Tb1_field3,
TABLE1.Tb1_field4, MYSUB.tb3_field1, MYSUB.tb3_field2, table4.code_desc
FROM TABLE1, table4,
(SELECT TABLE2.ID, TABLE2.code, TABLE2.role, TABLE2.flag,
TABLE3.tb3_field1, TABLE3.tb3_field2 WHERE TABLE2.role ='2' AND
TABLE2.flag='T' and TABLE3.TB3_ID = TABLE2.TB2_ID) MYSUB
WHERE TABLE1.ID = MYSUB.ID(+) and
table1.code = table4.code(+)
Can anyone help me how to put this in ACCESS query?
Thanks in advance!
AQ
I have this long query that extract datas from 12 tables, in that main query
there are 8 subqueries, it work fine with pass-thru, but now this query need
to do as access query. I need to have all info from table1, and only info
from table2 which matched table1, only info from table3 which matched
table2....
Below is example of 4 tables only since I need to understand the way to
right subqueries with access on a multi-outer join,
Relationships:
Table1--->Table2--->Table3
|
v
Table4
Table1 fields: ID(primary key), code,Tb1_field2, Tb1_field3, Tb1_field4... etc
Table2 fields: ID(foreign key), seq_id, TB2_ID(FK to table 3), flag,
tb2_field1, tb2_field2 ...etc
table3 fields: TB3_ID(PK), tb3_field1,tb3_field2...etc
Table4 fileds: code(pk), code_desc
my pass-thru like this:
SELECT DISTINCT TABLE1.ID,TABLE1.Tb1_field2, TABLE1.Tb1_field3,
TABLE1.Tb1_field4, MYSUB.tb3_field1, MYSUB.tb3_field2, table4.code_desc
FROM TABLE1, table4,
(SELECT TABLE2.ID, TABLE2.code, TABLE2.role, TABLE2.flag,
TABLE3.tb3_field1, TABLE3.tb3_field2 WHERE TABLE2.role ='2' AND
TABLE2.flag='T' and TABLE3.TB3_ID = TABLE2.TB2_ID) MYSUB
WHERE TABLE1.ID = MYSUB.ID(+) and
table1.code = table4.code(+)
Can anyone help me how to put this in ACCESS query?
Thanks in advance!
AQ