I got this query:
SELECT * FROM (
      SELECT 
      messages.* 
    FROM 
      messages
    ORDER BY 
      messages.created_at DESC
) as messages GROUP BY messages.contact_id
the timestamp it returned is still WRONG and not DESC:
before:
| id | contact_id | message | created_at          |
|  1 | 4          | ....    | 2023-03-10 19:48:06 |
|  2 | 3          | ....    | 2023-03-10 19:48:06 |
|  3 | 3          | ....    | 2023-03-11 19:48:06 |
|  4 | 4          | ....    | 2023-03-11 19:48:06 |
after:
| id | contact_id | message |  created_at          |
|  2 | 3          | ....    |  2023-03-10 19:48:06 |
|  1 | 4          | ....    |  2023-03-10 19:48:06 |
does anyone know why?
 
    