MySQL:使用JOINS的语句不会获取所有可能的记录

时间:2013-11-01 18:38:11

标签: php mysql sql

See the scenario here.

如问题中所述,我使用以下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”的记录。

0 个答案:

没有答案