如问题中所述,我正在使用以下 MySQL 生成排行榜。
SELECT DISTINCT t1.level, t3.user_id, t3.user_id2, t3.user_type
FROM leaderboard AS t1
INNER JOIN clear_times AS t2
ON (t1.uid = t2.uid AND (t1.level -1) = t2.level)
INNER JOIN registrations AS t3 ON (t1.uid = t3.id)
ORDER BY t1.level DESC, t2.clear_time ASC
但是该语句的问题在于它正在获取level
大于的用户记录1
。没有获取级别为“1”的记录。