I have a table with data something like below:
| ID(pk) | name | count |
|--------|------|-------|
| id1 | xyz | 98 |
| id2 | ptr | 5 |
| id3 | xyz | 2 |
| id4 | de | 1 |
| id5 | ptr | 1 |
I want to first have the row with max count then all the rows with same name sorted by count. After that next max count and all the counts with same name. Something like below:
| ID(pk) | name | count |
|--------|------|-------|
| id1 | xyz | 98 |
| id3 | xyz | 2 |
| id2 | ptr | 5 |
| id5 | ptr | 1 |
| id4 | de | 1 |
Is something like this possible in Postgres?