-1

I have this table named register and I need to get the max date for each personid that i have

re_id   | re_personid  | re_datetime(timestamp without time zone)

 4      | 19343834063  | 2021-04-27 10:30:42   
 7      | 34534534534  | 2021-04-26 11:00:42
 8      | 34534534534  | 2021-04-26 12:00:42
 9      | 4234234      | 2021-04-27 10:01:42
 10     | 4234234      | 2021-04-27 10:05:42
 11     | 56790134567  | 2021-04-27 10:00:42
 12     | 56790134567  | 2021-04-27 10:15:42
 13     | 56790134567  | 2021-04-27 10:20:42
  • Does this answer your question? [Select first row in each GROUP BY group?](https://stackoverflow.com/questions/3800551/select-first-row-in-each-group-by-group) – forpas Apr 27 '21 at 14:41

1 Answers1

0
SELECT re_personid, MAX(re_datetime)
FROM register
GROUP BY re_personid
Alan Millirud
  • 1,049
  • 7
  • 14