case when在sqlserver和oracle的不同写法

---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写法:
SELECT
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,count(*)
FROM JinRiLog.UserOperateLog partition (p2)
where Operatetype=8
group by
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
;

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...