4

我正在调试一些代码并遇到了这个。有人可以根据 SQL Server 的顺序在这个语句周围加上括号来帮助我。只是我,还是这是糟糕的编码?

WHERE 
T1.C1 = @VAR1 AND T1.C2 = @VAR2 AND T1.C3 NOT IN(@VAR3)
OR T2.C1 = @VAR2 OR T3.C1 = @VAR2
4

1 回答 1

5

照原样,它将被解析为

WHERE 
(T1.C1 = @VAR1 AND T1.C2 = @VAR2 AND T1.C3 NOT IN(@VAR3))
OR
(T2.C1 = @VAR2)
OR
(T3.C1 = @VAR2)
于 2013-06-13T18:47:19.343 回答