ORDER BY + LIMITsorry,沒看清楚。一個比較沒有效率的做法是SELECT customer, avg(amount) FROM record WHERE(SELECT count(*) FROM record as r WHEREr.customer = record.customer ANDr.date = record.date) <= 2 GROUP BY customer;如果是 MySQL 可以參考這個 http://goo.gl/Zzgt6W第一個少打一個大於...http://goo.gl/dXiUs1