I have the following table
Date, TelephoneNumber, Type
02/02/12, 123456, b
04/02/12, 123456, b
07/02/12, 123456, a
03/02/12, 789999, a
15/02/12, 789999, b
When running the following SQL
select TelephoneNumber, max(Date) as datetime, Type
from Table1
where Date > '2012-03-25 00:00'
group by TelephoneNumber
order by date desc;
I noted that the Type does not match its related Date. For example I am getting
07/02/12, 123456, b
15/02/12, 789999, a
It seems that it is taking the first record in Type .... even when I sorted in the other way round. Can someone please help me how I can solve this problem? I am using MySQL
Thanks in advance. sandro