回複:SQL 考試,大家踴躍參加

問題有缺陷

如果一個max(recordDate) 有多個價格怎麽辦?

select t.acccountID, a.mDate, t.price
from table t
(select acccountID, max(recordDate) as mDate
from table
group by acccountID) as a
where t. acccountID=a. acccountID
and t. recordDate=a.mDate
group by t.acccountID, a.mDate, t.price

請您先登陸,再發跟帖!