[SQL] CASE WHEN ELSE
CASE 可以做抓取內容的控制
SELECT Name, CASE (Sex) WHEN 'F' THEN 'Female' ELSE 'Male' END AS 'Sex' FROM Employee
CASE
我目前查到兩種用法
CASE (Sex) WHEN 'F' THEN 'Female' ELSE 'Male' END AS 'Sex'
CASE WHEN Sex='F' THEN 'Female' WHEN Sex='M' THEN 'Male' ELSE 'Unknow' END AS 'Sex'
WHEN *** THEN *** 這段是可以重複出現 DER ~~~
CASE ********** END 是必要的 !!!!