2016-11-24 138 views

回答

3

這是一個簡單MINMAX

SELECT CustomerId, 
     MIN(OrderDate) Min_Order_Date 
     MAX(OrderDate) Last_Order_Date 
FROM dbo.Orders 
GROUP BY CustomerId;