討論串[SQL ] 有關case when的兩個問題
共 6 篇文章
首頁
上一頁
1
2
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者Ifreet (Ifreet)時間12年前 (2013/06/07 17:17), 編輯資訊
0
0
0
內容預覽:
問題二的where後面應該改成"B.a='XX' and A.a is null". 因為where會先執行. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 116.12.221.66.

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者jengting (~~)時間12年前 (2013/05/26 08:03), 編輯資訊
0
0
0
內容預覽:
建議不要在 WHERE 中去進行 CASE WHEN、IIF()、ISNULL() 或 COALESCE(). 的動態篩選條件,會導致索引無法正常使用,造成效能問題。. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 61.62.56.115.

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者fantasyj (如夢似幻)時間12年前 (2013/05/25 23:23), 編輯資訊
0
0
0
內容預覽:
直接把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.
(還有496個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者bbsn (bbsn)時間12年前 (2013/05/18 13:49), 編輯資訊
0
0
0
內容預覽:
有關於問題一,我大致上修改成如下,不過會出來錯誤. 錯誤:無法繫結多重部分 (Multi-Part) 識別碼 "B.redate". select (case when B.redate is null then (case when B.des is null then. A.opdate els
(還有305個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者greetmuta (愚零鬥武多)時間12年前 (2013/05/18 01:23), 編輯資訊
0
0
0
內容預覽:
--問題一. select (case when (case when 2>1 then 'A' else 'B' end) ='A' then 'C' else. 'D' end) as my_column. --問題二. select * from test3 where price < (ca
首頁
上一頁
1
2
下一頁
尾頁