This is my example of my table:
id | name | foreign_id |
1 a 100
2 b 100
3 c 100
4 d 101
5 a 102
6 b 102
7 c 102
I would like to get the distinct file with the latest foreign_id (bigger number but not necessarily biggest). In this example, it would be row with id 4,5,6,7. Anyone has any idea? Thank you very much!