舉例1:it
使用該查詢,得出iFavoriteID,iFavUserType ,cUser,iArticleID,dFavoriteTime五個字段的值:im
SELECT iFavoriteID,ember
CASE WHEN iFavUserType = 0 THEN '新聞管理員'查詢
WHEN iFavUserType = 1 THEN '商家'tab
WHEN iFavUserType = 2 THEN '會員'di
WHEN iFavUserType = 3 THEN '未註冊'ab
WHEN iFavUserType = 4 then '匿名'管理
END AS iFavUserType, cUser, iArticleID,註冊
CONVERT(nvarchar(100), dFavoriteTime, 111) AS dFavoriteTime FROM dig_favoritearc
舉例2:
SELECT CASE WHEN `MEMBERTYPE` =1
THEN '參賽隊員'
ELSE '指導老師'
END FROM `tab_sign_member`
WHERE 1