“<>” vs “NOT IN”

后端 未结 9 1468
Happy的楠姐
Happy的楠姐 2020-12-14 17:53

I was debugging a stored procedure the other day and found some logic something like this:

SELECT something
FROM someTable
WHERE idcode <> (SELECT ids          


        
9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-14 18:21

    <> is a "singular" NOT operation; NOT IN is a set operation, so it makes sense that the former wouldn't work. I have no idea whether or not it may have done so under a previous version of SQL Server, however.

提交回复
热议问题