我想从以下查询中对命中计数进行分类。我已经尝试过,但它给了我错误。任何人都可以帮忙吗?
select case when (a.hit between 0 and 5) then 0
when (a.hit between 6 and 10) then 1
else 2,
from
(select
distinct u.USER_NAME,
r.VIEW_TYPE,
B.ORG,
g.CLUSTER
,Count(*) As HIT
from
dbo.Parameter p,
dbo.Report r,
dbo.User u,
dbo.TimeStamp t,
dbo.UserLog f,
dbo.APP_USER B,
(
select CLUSTER,COUNTRY
from [dbo].[GEO]
union
select distinct CLUSTER,CLUSTER
from [dbo].[GEO]
) G
where
p.PARAM_ID=f.PARAM_ID
and r.REPORT_CUBE_ID=f.REPORT_ID
and u.USER_NAME=f.USER_ID
and r.VIEW_TYPE=f.ViewType
AND T.TIME_STAMP_ID=F.[TIME STAMP_ID]
AND u.EMAIL = B.EMAIL
AND u.USER_NAME=B.USER_ID
and p.GEO = G.COUNTRY
and r.VIEW_TYPE='Industry View'
group by CLUSTER,USER_NAME,VIEW_TYPE,b.ORG
order by CLUSTER,USER_NAME,VIEW_TYPE,b.ORG) a