T-SQL: select rows not equal to a value, including nulls

前端 未结 5 461
闹比i
闹比i 2021-01-17 07:25

How do I select rows which don\'t equal a value and also include nulls in the returned data? I\'ve tried:

SET ANSI_NULLS OFF
SELECT TOP 30 FROM Mails
WHERE a         


        
5条回答
  •  伪装坚强ぢ
    2021-01-17 08:21

    Try checking for NULL explicitly:

    SELECT TOP 30 col1, col2, ..., coln
    FROM Mails
    WHERE (assignedByTeam <> 'team01' OR assignedByTeam IS NULL)
    

提交回复
热议问题