2012-07-30 21 views

回答

1
select id, uid from table1 where a=(select max(a) from table1) 

當然,如果您有多個相同的最大值,這會失敗。

1

我想試試這個:

SELECT id, uid, a FROM table1 ORDER BY a DESC LIMIT 1 
0

如果你只是想獲得ID只使用MAX(ID)的最大值。

SELECT MAX(id), uid, MAX(a) from table GROUP BY uid; 
+0

這將返回最大ID和最大a,這可能在兩個不同的行中。 – Fluffeh 2012-07-31 09:06:44

+1

對不起,我明白你的問題是錯的。 – 2012-07-31 10:12:46

相關問題