Bit of an sql noob, have a list in table a of customercodes/phone numbers, and table b has all the call records.
I want to select the most recent call from table b for each of the customercodes/phone numbers in table a.
So far I have:
SELECT A.CustomerCode, A.PhoneNumber, B.StartTime
FROM tableA A INNER JOIN
tableB B ON ( A.PhoneNumber = B.PhoneNumber
AND A.CustomerCode = B.CustomerCode )
ORDER BY A.CustomerCode, A.CLI, B.StartTime DESC
But that is bringing up all the results from TableB. I literally just want to get the most recent call if that makes sense?