你好,我有如下表設計由Max日期選擇ACCOUNT_ID
ID account_id score date ------------------------------------------ 1 500 4 x 2 764 4 x 3 500 6 x 4 500 7 x 5 764 5 x
我試圖讓所有行與最新的ACCOUNT_ID進入
所以我的代碼應該返回
ID account_id score date ------------------------------------------ 4 500 7 x 5 764 5 x
我試過下面的代碼,但它似乎返回的第一個條目,但與最新日期
SELECT account_id,score, max(date) from table group by account_id
哇,太感謝你了,我決定去與案例1。 – Amanda1990