给定两个表 nf_users 和 nf_wr_year 以及以下查询,如何向 nf_users 表添加内部联接以选择其他列?
SELECT
points,
played,
wins
FROM (
SELECT
p.*,
@i:=@i + 1 rank,
@match:=IF(p.points = 528, @i, @match)
FROM
nf_wr_year p,
(SELECT @i:=0, @match:=0) vars
ORDER BY p.points
) t
WHERE @match >= rank - 2
AND @match <= rank + 2