SQL Server: Select in vs or?

后端 未结 3 1802
执念已碎
执念已碎 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:29

    This is relevant when it comes to producing SQL via Linq. There are some instances where the sql created is in the form of: field='xxx' OR field='yyy'.

提交回复
热议问题