在開發的過程中有一些列需要經過變化顯示給用戶,這是用到Case就比較合理
例如下表的結構
select * from Course
把課時爲6的顯示爲正常,其他的不正常
用case 如下顯示
select course.courseName , 課時數=
case Course.creditHour
when 6 then '正常'
else '不正常'
end
from Course
在開發的過程中有一些列需要經過變化顯示給用戶,這是用到Case就比較合理
例如下表的結構
select * from Course
把課時爲6的顯示爲正常,其他的不正常
用case 如下顯示
select course.courseName , 課時數=
case Course.creditHour
when 6 then '正常'
else '不正常'
end
from Course