sqlスクリプトで考慮する必要のある「特殊なケース」があります。これは私がこれまでに持っているものであり、私はそれが機能すると「思います」が、それは厄介なようです。そのsprocため、パラメータがあると仮定し@empStatusます。従業員の場合は、すべての従業員のをまたは@empStatus=2で返します。Status12
select *
from Employees
where Title='Associate' and Status=@empStatus and Department='Sales'
OR (@empStatus=2 and (Status=@empStatus or Status=1) and Title='Associate' and Department='Sales')