I have a user table that look like this :
| id | dtCreation | type | 
|---|---|---|
| 1 | 2022-01-01 00:00:00 | aaa | 
| 2 | 2021-01-01 00:00:00 | aaa | 
| 3 | 2022-01-01 00:00:00 | bbb | 
| 4 | 2021-01-01 00:00:00 | bbb | 
| 5 | 2021-01-01 00:00:00 | ccc | 
| 6 | 2021-01-01 00:00:00 | ccc | 
And I'm trying to get the last created user (by dtCreation) for each type.
So far I select everything with group done on the type and selecting the line with the highest creation date in each group with the HAVING clause.
My request is :
  SELECT u.id, u.dtCreation, u.type FROM users u 
   WHERE u.type IN ('aaa','bbb','ccc')
GROUP BY u.type 
  HAVING MAX(u.dtCreation) = u.dtCreation;
But I don't get any result from this request, is there something that I'm missing ?
