Hi all,
I've got decent help here and am still looking for more.
This time I am trying to find records with minimum values. My sample data looks like below:
| personid | days_gap |
| 1 | 0 |
| 1 | 0 |
| 1 | 10 |
| 1 | 10 |
| 1 | 10 |
| 1 | 15 |
| 2 | 9 |
| 2 | 9 |
| 2 | 9 |
| 2 | 9 |
| 2 | 24 |
| 2 | 24 |
| 2 | 30 |
| 2 | 30 |
| 3 | 1 |
| 3 | 6 |
| 3 | 6 |
| 3 | 8 |
| 3 | 8 |
| 3 | 8 |
| 3 | 9 |
| 3 | 9 |
| 3 | 9 |
My target data is
| personid | days_gap |
| 1 | 0 |
| 1 | 0 |
| 2 | 9 |
| 2 | 9 |
| 2 | 9 |
| 2 | 9 |
| 3 | 1 |
That is, I want to find records with minimum value of days_gap for each personid. Does anyone know a way to do it?
Thanks a lot as always!
Lizi