SQL - Multi Where子句

时间:2016-02-10 03:54:24

标签: sql-server

这个巨大的where条款为所有国家产生了输出,但我提到了墨西哥。我是否需要更改条款的顺序。

请注意,在OR条件下,开头有一个[exec],最后有10个。这可能是个问题。

Select *
from tblKPI
WHERE Date>='2016-01-01' AND Date<='2019-01-01' 
AND [Exec] LIKE 'joselinemasis' 
AND Customer LIKE '%%' 
AND Country LIKE 'Mexico' 
AND Payroll LIKE '%%' OR [exec] = 'Albenalukanova' 
OR [exec] = 'amitkumar' OR [exec] = 'AsthaChadha' 
OR [exec] = 'barbaranyari' OR [exec] = 'BereniceParedes' 
OR [exec] = 'Bhawnasingh' OR [exec] = 'edgaralcantara' 
OR [exec] = 'elidethcisneros' OR [exec] = 'FruzsinaKaraszi' 
OR [exec] = 'joselinemasis'

0 个答案:

没有答案