Trying to build a SQL select statement to find a single MAX date value per customer within a group of possible values. Have a single table CUST1 with fields CUSTID, ORDERNO, ORDERDATE, SERIES. A customer may place many orders within several product series. I'm trying to find a single return value for the last date the customer bought product within a specific group of product series. The query I am using is attached. Problem is that the query returns the MAX date for orders within each SERIES, so for each CUSTID there may be more than one record returned. I need only one MAX date returned per CUSTID. Also I need a WHERE clause to further filter the MAX date within a date range.
Thanks!
Start Free Trial