Is grouping possible after sorting in MySQL? I read some articles regarding this, but none of the implementations were able to give me the result that I want.
My current data structure (after multiple joins) is
What I am willing to achieve is to group the data by pid where the data is sorted in desc order as per the created_at date.
pid id ....
3 16 ....
4 8 ....
2 6 ....
1 5 ....
Any idea on how this can be acheived?