国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > SQL Server > 正文

世界杯猜想活動的各類榜單的SQL語句小結

2024-08-31 00:58:28
字體:
來源:轉載
供稿:網友
/*增幅降幅排名*/

復制代碼 代碼如下:


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

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌审旗| 延川县| 思茅市| 卓资县| 深泽县| 若尔盖县| 和田市| 麟游县| 蒙自县| 监利县| 二连浩特市| 内江市| 曲阜市| 蒲城县| 朝阳区| 江津市| 景谷| 抚宁县| 虎林市| 永顺县| 南充市| 鲁甸县| 大荔县| 鄂州市| 邳州市| 大石桥市| 德州市| 分宜县| 新竹市| 民勤县| 兴文县| 永胜县| 易门县| 上蔡县| 邳州市| 交城县| 通辽市| 特克斯县| 策勒县| 都昌县| 富宁县|