/*增幅降幅排名*/
复制代码 代码如下:
select top 50 username,sum(receiveprice) – sum(guessprice) as receiveprice,
cast(sum(case when receiveprice>0 then 1.0 else 0 end) / count(receiveprice) * 100 as numeric(4,1)) as rate
from [game_fantasylog]
where isjudge=1
group by userid,username
order by sum(receiveprice) – sum(guessprice) asc
/*正确率错误率排名*/
复制代码 代码如下:
select top 50 username,sum(receiveprice) – sum(guessprice) as receiveprice,
cast(sum(case when receiveprice>0 then 1.0 else 0 end) / count(receiveprice) * 100 as numeric(4,1)) as rate
from [game_fantasylog]
where isjudge=1
group by userid,username having count(userid) >= 5
order by cast(sum(case when receiveprice>0 then 1.0 else 0 end) / count(receiveprice) * 100 as numeric(4,1)) asc
/*大手笔排名*/
复制代码 代码如下:
select top 50 l.username,sum(l.guessprice),sum(l.receiveprice),f.title
from [game_fantasylog] l left join [game_fantasy] f on l.topicid = f.id
group by l.topicid,l.username,f.title
order by sum(l.guessprice) desc
/*冷门场次排名*/
复制代码 代码如下:
select top 50 f.id,f.title,f.guessprice,(select sum(receiveprice) from [game_fantasylog] l where l.topicid = f.id),
cast((select sum(case when receiveprice>0 then 1.0 else 0 end) / f.guesstimes from [game_fantasylog] l2 where l2.topicid = f.id) as numeric(4,2))
from [game_fantasy] f where f.guessprice > 1000
order by (select sum(receiveprice) from [game_fantasylog] l where l.topicid = f.id) asc
/*冷门场次的命中者*/
复制代码 代码如下:
select top 50 username,sum(receiveprice) as receiveprice
from [game_fantasylog] where topicid=29
group by topicid,username
order by sum(receiveprice) desc