我试图找出这位特定球员在 NBA 得分后卫中的排名。我正在使用stackoverflow 上的这篇文章作为指南。
我收到错误“无效使用组功能”。
SELECT
first,
last,
team,
pos,
SUM(points) AS scoresum,
ROUND(AVG(points), 2) AS avgpoints,
(SELECT
COUNT(*)
FROM nbaboxscore AS bpnb
WHERE (bpnb.first, bpnb.last, SUM(bpnb.points)) >= (bpn.first, bpn.last, SUM(bpn.points))) AS rank
FROM nbaboxscore AS bpn
WHERE bpn.pos = 'SG'
AND bpn.date >= '2009-10-01'
AND FIRST = 'Joe'
AND LAST = 'Johnson'
GROUP BY bpn.first, bpn.last, bpn.team
ORDER BY scoresum DESC
我不确定这是否可能?