I've tried and searched all the day before post but I'm not able to figure out how to solve my problem.
I've a table essentially like this
ID | Name | RelatedTo | CreatedAt | Revision
Basically this track a document name with its content and if is which revision is (0,1,2,3,...) and if it's related to a "father" document (optional).
A document can have or not a revision
ID | Name | RelatedTo | CreatedAt | Revision
1 | A | | 2019-11-01| 0
2 | B | | 2019-11-01| 0
3 | | 2 | 2019-11-04| 1
I was start from this post but I'm not able to make it working for my case.
I need to select the master record (ex A and B) and the last CreatedAt field (2019-11-01 for A, 2019-11-04 for B).