SQL Server: Select in vs or?

后端 未结 3 1776
执念已碎
执念已碎 2020-12-16 12:03

Which is faster?

SELECT UserName
FROM dbo.UserTable
WHERE UserID in (1,3,4)

SELECT UserName
FROM dbo.UserTable
WHERE UserID =         


        
3条回答
  •  执念已碎
    2020-12-16 12:37

    Due to Sql Server's optimization of queries these will run at the same speed since they are logically equivalent.

    i favor the IN syntax for brevity and readability though.

提交回复
热议问题