Assuming you're using a DBMS that supports it,
the ROW_NUMBER
function[
^] is what you're looking for:
WITH cteOrderedResults As
(
SELECT
SomeColumns,
ROW_NUMBER() OVER (PARTITION BY Customer ORDER BY TheDate DESC) As RN
FROM
YourTable
)
SELECT
SomeColumns
FROM
cteOrderedResults
WHERE
RN = 1
;
NB: For future reference, always specify which DMBS you are using, including the version number. Also, it helps to include the basic structure of your table, and some example data. If possible, use
SQLFiddle[
^] to create a small sample of the problem.