为什么 OR 在 WHERE 子句中被忽略?

why is the OR being ignored in the WHERE clause?

我有以下握手table:

CREATE TABLE [dbo].[Handshake](
    [Report Year] [varchar](100) NULL,
    [Status] [varchar](100) NULL,
    [Update Time] [datetime] NULL,
    [Process Time] [datetime] NULL,
    [Rejects?] [varchar](10) NULL
) ON [PRIMARY]
GO

如果我运行这个查询,

SELECT TOP (1) * 
FROM [dbo].[Handshake]
WHERE [Status] <> 'Loading' OR [Status] <> 'Processing' OR [Status] <> 'Processed' OR [Status] <> 'Process Failed'
ORDER BY [Update Time] DESC

我希望不会返回 WHERE 子句中指示的任何内容,但它是!! 例如,Processed 记录不应返回!!

这是我得到的:

示例数据

Report Year Status      Update Time             Process Time            Rejects?
2020 8+4    Processed   2020-10-09 16:58:05.610 2020-10-09 17:20:05.000 NULL
2020 8+4    Processed   2020-10-09 16:22:06.343 2020-10-09 16:53:26.000 NULL
2020 5+7    Processed   2020-09-29 18:09:00.000 2020-10-09 16:04:04.000 TRUE
2020 6+6    Failed  2020-09-29 17:21:00.000 NULL    NULL
2020 5+7    Processed   2020-09-29 15:54:00.000 2020-10-09 16:04:04.000 NULL

你似乎想要 AND,而不是 OR:

WHERE [Status] <> 'Loading' 
  AND [Status] <> 'Processing' 
  AND [Status] <> 'Processed' 
  AND [Status] <> 'Process Failed'

你也可以用not in来表达:

WHERE [Status] NOT IN ('Loading', 'Processing', 'Processed', 'Process Failed')