I Have a Table For example posts With this structure and Data :
ID | CatID | SubCatID | Title
-----------------------------
1 | 84 | 85 | Test 1
2 | 84 | 86 | Test 2
3 | 84 | 87 | Test 3
4 | 84 | 85 | Test 4
5 | 84 | 85 | Test 5
6 | 84 | 86 | Test 6
I want 1 query that return rows that group by SubCatID and return rows that have a MaxID From each SubCat
It means I want to return this list:
ID | CatID | SubCatID | Title
--------------------------------
5 | 84 | 85 | Test 5
6 | 84 | 86 | Test 6
3 | 84 | 87 | Test 3
1 Answer