Outer Joins 
Author Message
 Outer Joins

I am trying to figure out a way to perform a left and a right outer join at
the same time on serveral tables.  What I want to do is perform an outer
join to return a series of records.  I want a record to be present whether
there is a value in any particular table even if there is not a record in
any other table.  There is no one table that defines really whether or not
there will be a record present for the rest of the tables so using a left
join on one main table will not work.  Thanks

Spencer Tabbert



Sun, 20 May 2001 03:00:00 GMT  
 Outer Joins
Try using two or more queries ...

Alberto Borbolla
Microsoft MVP
Tecnologia en Sistemas
MEXICO

(replace "X" to send mail)



Sun, 20 May 2001 03:00:00 GMT  
 Outer Joins
Spencer --
    SELECT T1.V11,...T1.V1N,T2.V21,...T2.V2N
    FROM T1 LEFT JOIN T2 on T1.KEY=T2.KEY
    UNION
    SELECT NULL,...,NULL,T2.V21,...T2.V2N
    FROM T2
    WHERE T2.KEY NOT IN
        (SELECT KEY FROM T1)
If you have a lot of tables, this can become tedious and slow.  Then you
might want to program it as a merge:
(1) open all tables in key order
(2) do until eof on all tables
(2.1) find table with lowest key value
(2.2) add new output record with all variables null
(2.3) for all tables with key=lowest key value
(2.3.1) set output variables=input variables
(2.3.2) move next
(2.4) update output record
(3) close all tables
HTH, Roger
Quote:
>I want a record to be present whether
>there is a value in any particular table even if there is not a record in
>any other table.
>Spencer Tabbert



Mon, 21 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. outer join with ACCESS

2. Access 2000 -Full Outer Join

3. How DAO works with outer join query with Parameter

4. No outer joins with Jet 4 drivers?

5. sql poser: OUTER JOINS?

6. SQL Builder - Outer Joins.

7. E_FAIL when outer-joining

8. Ambiguous Outer Joins....

9. Access OUTER JOIN syntax

10. SQL Builder - Outer Joins.

11. E_FAIL when outer joining

12. DAO Left Outer Join Update Problem

 

 
Powered by phpBB® Forum Software