Results 1 to 2 of 2

Thread: Outer joins

  1. #1
    Join Date
    Oct 2004
    Posts
    5

    Unanswered: Outer joins

    Hi

    I need to use an outerjoin to join 2 tables but they need to be joined based on 2 colums.

    tablea: tableb:
    col1 col1
    col2 col2
    col3 cola
    col4 colb
    ... ...


    so they need to be joinen basen on col1 and col2

    select count(*)
    from tablea a
    left outer join tableb b
    on a.col1 = b.col1
    ....

    the rest i'm unable to find... could someone help me with this?

    regards

  2. #2
    Join Date
    Oct 2004
    Location
    Norway
    Posts
    53
    SELECT ... FROM TBLA A LEFT OUTER JOIN TBLB B ON B.COL1 = A.COL1 AND B.COL2 = A.COL2 WHERE ...

    This is one alternative ...

    Beware of the keyword AND in JOIN conditions versus using the WHERE clause.

    ---

Posting Permissions

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