2013-06-25 95 views

回答

3
SELECT a.* 
FROM tableName a 
     INNER JOIN 
     (
      SELECT username, MAX(n_loads) n_loads 
      FROM tableName 
      GROUP BY username 
     ) b ON a.username = b.username AND 
       a.n_loads = b.n_loads 

SELECT a.* 
FROM tableName a 
WHERE n_loads = 
     (SELECT MAX(b.n_loads) 
     FROM tableName b 
     WHERE a.username = b.username); 
+2

答案需要一個+1。好的答案.. !!窗口函數是一個很好的選擇..但不支持MySQL .. !! – user2407394

相關問題