Workaround for outer join with an IN operator in Oracle

后端 未结 3 1639
萌比男神i
萌比男神i 2021-01-13 16:18

I am using Oracle SQL, so outer joins have the nice (+) syntax. I should warn you that I am not allowed to redesign the database; I work for a large organization.

He

3条回答
  •  既然无缘
    2021-01-13 16:54

    First of all, why can't you use proper OUTER JOINs?, you can use them in Oracle without having to do the implicit joins with the (+) syntax. As for your problem, you can use IN:

    SELECT p.Name, a.Attribute
    FROM People p
    LEFT OUTER JOIN Attributes a
    ON p.PersonID = a.PersonID AND a.Attribute IN ('Happy','Grouchy')
    

提交回复
热议问题