SQL Server:OR运算符未返回所需结果

时间:2017-08-17 03:33:07

标签: sql-server left-join

我正在尝试选择会员安排了搜索或被邀请进行搜索的所有记录。但是我的查询只返回成员安排了搜索的记录。有任何想法吗?我假设问题出在LEFT OUTER JOIN。感谢

SELECT
    Hunt.ID, Hunt.MemberID,
    Hunt.PropertyID, Hunt.HuntDate, 
    Hunt.SeasonID,
    Property.ID, Property.Lat, Property.Long,
    Property.Zoom,
    Invited.ID, Invited.HuntID, Invited.MemberID, Invited.SeasonID
FROM 
    Hunt
INNER JOIN 
    Property ON Hunt.PropertyID = Property.ID
LEFT OUTER JOIN 
    Invited ON Hunt.ID = Invited.HuntID
WHERE 
    Hunt.MemberID = @MemberID
    OR Invited.MemberID = @MemberID

0 个答案:

没有答案