0

有没有办法通过优化/压缩代码来加快速度?

SELECT fullName,
       email_address,
       pos_desc,
       EXT
FROM   dbo.BTC_WEB_EMPLOYEE_VIEW
WHERE  grp_cde = 'STAFF'
        OR grp_cde = 'PROF'
        OR grp_cde = 'EXEC'
        OR grp_cde = 'ADMIN'
        OR grp_cde = 'FAC'
ORDER  BY last_name 
4

1 回答 1

2

使用 IN 而不是 OR

SELECT fullName, email_address, pos_desc, EXT 
FROM dbo.BTC_WEB_EMPLOYEE_VIEW 
WHERE grp_cde IN ( 'STAFF', 'PROF', 'EXEC', 'ADMIN', 'FAC') 
ORDER BY last_name

可能这可以帮助或在此列上使用索引

于 2013-06-05T12:52:36.073 回答