with [temps] as
(
select row_number() over(PARTITION BY LID order by RID Desc) as TID,LID,Result from Results
)
select Lid,sum(case when TID>=1 and TID <=10 then 1 else 0 end) as [C010]
from temps where Result = 1
GROUP BY Lid上面的语名中,判断C010大于N的记录!怎么加啊
(
select row_number() over(PARTITION BY LID order by RID Desc) as TID,LID,Result from Results
)
select Lid,sum(case when TID>=1 and TID <=10 then 1 else 0 end) as [C010]
from temps where Result = 1
GROUP BY Lid上面的语名中,判断C010大于N的记录!怎么加啊
with [temps] as
(
select row_number() over(PARTITION BY LID order by RID Desc) as TID,
LID,Result from Results
)
select Lid,sum(case when TID>=1 and TID <=10 then 1 else 0 end) as [C010]
from temps where Result = 1 GROUP BY Lid
having sum(case when TID>=1 and TID <=10 then 1 else 0 end)>N
(
select row_number() over(PARTITION BY LID order by RID Desc) as TID,LID,Result from Results
)
select Lid,sum(case when TID>=1 and TID <=10 then 1 else 0 end) as [C010]
from temps
where Result = 1
GROUP BY Lid
having sum(case when TID>=1 and TID <=10 then 1 else 0 end) > N
(select row_number()over(PARTITION BY LID order by RID desc) as TID,g
Lid,result from results
)
select Lid,sum(case when Tid>=1 and TID<=10 then 1 else 0 end) as [c010]
from temps where Result=1
group by Lid
having sum(case when Tid>=1 and Tid<=10 then 1 else 0 end)>N
with [temps] as
(
select row_number() over(PARTITION BY LID order by RID Desc) as TID,LID,Result
from Results
)
select Lid,sum(case when TID>=1 and TID <=10 then 1 else 0 end) as [C010]
from temps where Result = 1
GROUP BY Lid
having sum(case when TID>=1 and TID <=10 then 1 else 0 end)>N