世界杯猜想活动的各类榜单的SQL语句小结

2022-05-24 0 334

/*增幅降幅排名*/


复制代码 代码如下:

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

免责声明:
1、本网站所有发布的源码、软件和资料均为收集各大资源网站整理而来;仅限用于学习和研究目的,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。 不得使用于非法商业用途,不得违反国家法律。否则后果自负!

2、本站信息来自网络,版权争议与本站无关。一切关于该资源商业行为与www.niceym.com无关。
如果您喜欢该程序,请支持正版源码、软件,购买注册,得到更好的正版服务。
如有侵犯你版权的,请邮件与我们联系处理(邮箱:skknet@qq.com),本站将立即改正。

NICE源码网 MsSql 世界杯猜想活动的各类榜单的SQL语句小结 https://www.niceym.com/60139.html