---sqlserver寫法:SELECT COUNT(1),remark FROM ( SELECT Remark=CASE WHEN Remark LIKE '%CHECK TKT TIME%' THEN '保留時間有問題' WHEN Remark LIKE '%WITH "AV" AGAIN%' THEN '沒有艙位' WHEN Remark LIKE 'DUPLICATE TEL NUMBER%' THEN '訂位授權OFFICE號重複' WHEN Remark LIKE '%INVALID FOID%' THEN '證件號錯誤' ELSE '其他' end FROM JinRiLogger.dbo.UserOperateLog201307 WITH(NOLOCK) WHERE OperateType=8 ) AS a GROUP BY a.Remark---oracle寫法:SELECTCASE WHEN Remark LIKE '%CHECK TKT TIME%' THEN '保留時間有問題' WHEN Remark LIKE '%WITH "AV" AGAIN%' THEN '沒有艙位' WHEN Remark LIKE 'DUPLICATE TEL NUMBER%' THEN '訂位授權OFFICE號重複' WHEN Remark LIKE '%INVALID FOID%' THEN '證件號錯誤' ELSE '其他' end,count(*)FROM JinRiLog.UserOperateLog partition (p2)where Operatetype=8group byCASE WHEN Remark LIKE '%CHECK TKT TIME%' THEN '保留時間有問題' WHEN Remark LIKE '%WITH "AV" AGAIN%' THEN '沒有艙位' WHEN Remark LIKE 'DUPLICATE TEL NUMBER%' THEN '訂位授權OFFICE號重複' WHEN Remark LIKE '%INVALID FOID%' THEN '證件號錯誤' ELSE '其他'end;
本文出自 “記錄點滴!” 部落格,請務必保留此出處http://ocpyang.blog.51cto.com/3401739/1300170