我有兩列的情況條件的別名列,我需要應用與多個範圍之間,我試過Alias between 10 and 1000 OR Alias between 2000 and 4000
它需要太多的時間來執行。請建議正確的方式或替代方式。SQL查詢與「之間」的別名列與多個範圍
我的查詢:
select X.Id, X.Name
from TableX X
where ((CASE WHEN X.a ='True' THEN X.Id ELSE X.PId END) between 0 and 1000
OR (CASE WHEN X.a ='True' THEN X.Id ELSE X.PId END) between 2000 and 4000)
saaduu你看我的回答嗎? – Yossi