Sqlite order by random groups
I have a table of songs with columns of tracks and albums and I want to get them in random album order. that is, in each album, the songs will be sorted, but the albums will be in random order.
For example, if the table:
-----------------
| track | album |
-----------------
| 1 | a |
| 2 | a |
| 3 | a |
| 1 | b |
| 2 | b |
| 1 | c |
| 2 | c |
-----------------
what is the possible way out
-----------------
| track | album |
-----------------
| 1 | b |
| 2 | b |
| 1 | c |
| 2 | c |
| 1 | a |
| 2 | a |
| 3 | a |
-----------------
Can a single sqlite query be executed?
+3
source to share
2 answers