Here I have a data sample:
| Title | Size | Count |
|---|---|---|
| First | 3 | 14 |
| First | 5 | 3 |
| Second | 2 | 5 |
| First | 2 | 10 |
| Third | 3 | 10 |
| Second | 3 | 4 |
| Third | 2 | 9 |
| Third | 5 | 11 |
| Second | 5 | 4 |
Now I want to sort the data with following rules:
Put the records with same title together: First followed by First, Second followed by Second.
Then for each group, order them by size;
For groups, order them in the sum of count of each group, like: sum of First is 14+3+10=27, Second is 5+4+4=13, Third is 10+9+11=30.
The result I want:
| Title | Size | Count |
|---|---|---|
| Second | 2 | 5 |
| Second | 3 | 4 |
| Second | 5 | 4 |
| First | 2 | 10 |
| First | 3 | 14 |
| First | 5 | 3 |
| Third | 2 | 9 |
| Third | 3 | 10 |
| Third | 5 | 11 |