看板 Database 關於我們 聯絡資訊
: 直接把case條件式寫在where後試試 : select * : from 資料表A as A join 資料表B as B on A.no = B.no : where (case : when B.redate is null then : (case : when B.des is null then : A.opdate : else : B.opdate : end) : else : B.redate : end) = '2013/05/05'; 建議不要在 WHERE 中去進行 CASE WHEN、IIF()、ISNULL() 或 COALESCE() 的動態篩選條件,會導致索引無法正常使用,造成效能問題。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.62.56.115