Left Outer join and an additional where clause

前端 未结 5 972
南方客
南方客 2020-12-18 18:05

I have a join on two tables defined as a left outer join so that all records are returned from the left hand table even if they don\'t have a record in the right hand table.

5条回答
  •  温柔的废话
    2020-12-18 18:42

    Yes, put the condition (called a predicate) in the join conditions

       Select [stuff]
       From TableA a
           Left Join TableB b
               On b.Pk = a.Pk
                   -- [Put your condition here, like this]
                   And b.Column = somevalue
    

提交回复
热议问题