您可以幫助我將這段代碼轉換爲邏輯運算符,並使用'like'
而不是'='
因爲我知道將where語句放在where子句上效率不高。蒂亞!這是代碼。將case case語句轉換爲where子句中的邏輯運算符
Where
(@reftype = '0' or
(@refnum = case @reftype when 'BN' then refBN when 'C' then refC when 'O' then refO else 'n/a' end)
)
您可以幫助我將這段代碼轉換爲邏輯運算符,並使用'like'
而不是'='
因爲我知道將where語句放在where子句上效率不高。蒂亞!這是代碼。將case case語句轉換爲where子句中的邏輯運算符
Where
(@reftype = '0' or
(@refnum = case @reftype when 'BN' then refBN when 'C' then refC when 'O' then refO else 'n/a' end)
)
更換
or @refnum = case @reftype when 'BN' then refBN when 'C' then refC when 'O' then refO else 'n/a' end)
與
or (@reftype = 'BN' AND @refnum = refBN)
or (@reftype = 'C' AND @refnum = refC)
or (@reftype = 'O' AND @refnum = refO)
or @refnum = 'n/a'
謝謝juergen。 – jian
感謝您編輯Tim。我做了翻譯,但我的上司說錯了。這裏是我的代碼:其中(@ reftype ='0'或(@reftype ='BN'和refBN如@refnum)或(@ reftype ='C'和refC像@refnum)或(@ reftype ='O'和refO就像@ refnum)或(@ reftype ='n/a'))我不知道我在想什麼。 – jian