Re: HELP! OUTER JOIN QUERY

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rich P

    Re: HELP! OUTER JOIN QUERY

    Greetings,

    Left Join (outer join) queries are generally for excluding stuff.

    select t1.* from tblx t1 Left Join tbly t2 on t1.ID = t2.ID and t1.fld1
    = t2.fld1 and t1.fld2 = t2.fld2...
    Where t2.ID Is Null And t1.fld1 = something and t1.date1 #somedate#
    ...

    You may want to perform your comparisons fisrt and the do a left join on
    the resulting subset.

    Another thing you could do is to use a Where Not Exists clause for
    excluding stuff. This will require an unique key column (usually an
    Identity column - autonum)

    Select t1.* from tblx t1 Where Not Exits (select * from tbly t2 Where
    t2.ID = t1.ID)

    Rich

    *** Sent via Developersdex http://www.developersdex.com ***
  • Luting

    #2
    Re: HELP! OUTER JOIN QUERY

    On Aug 11, 9:46 am, Rich P <rpng...@aol.co mwrote:
    Greetings,
    >
    Left Join (outer join) queries are generally for excluding stuff.
    >
    select t1.* from tblx t1 Left Join tbly t2 on t1.ID = t2.ID and t1.fld1
    = t2.fld1 and t1.fld2 = t2.fld2...
    Where t2.ID Is Null And t1.fld1 = something and t1.date1 #somedate#
    ..
    >
    You may want to perform your comparisons fisrt and the do a left join on
    the resulting subset.
    >
    Another thing you could do is to use a Where Not Exists clause for
    excluding stuff.  This will require an unique key column (usually an
    Identity column - autonum)
    >
    Select t1.* from tblx t1 Where Not Exits (select * from tbly t2 Where
    t2.ID = t1.ID)
    >
    Rich
    >
    *** Sent via Developersdexht tp://www.developersd ex.com***
    Thank you.
    The problem is solved.

    Comment

    Working...