DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: SQL... but in sybase

  1. #1
    In sybase, we are trying to do an outer join to 2 levels...

    i.e. table A outer joing to table B... and table B outer join to Table C.


    so the where clause would be like this...

    WHERE
    TABLE_A.colA1 *= TABLE_B.colB1
    AND TABLE_B.colB2 = TABLE_C.colC1

    note, I am outer joining down the tree, but different columns are being joined from A to B, and B to C.

    This fails in sybase... it gives me an WHERE CLAUSE ERROR statement.

    Is this even possible in Oracle? Any ideas around this?

    thanks

  2. #2
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    First of all, I don't remember any more, does *= correspond to (+)= or =...(+)?

    Next, you say that you are outer-joining b to c, but your example does not show this.

    - Chris

  3. #3
    Join Date
    Aug 2000
    Posts
    462
    How the tables are related will determine how to relate the tables. If there is one common column in all three tables which relates them, such as an SSN, then one of the three tables must contain all of the records, and be related to the other two tables in the where clause:

    select * from tableA, tableB, tableC
    where tableA.col=tableB.col(+) and
    tableA.col = tableC.col(+);

    However, if there is a relationship between tables A and B, and a different relationship between tables B and C, then:

    select * from tableA, tableB, tableC
    where tableA.col=tableB.col_1(+) and
    tableB.col_2=tableC.col(+);


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width