Long-time reader, first-time poster here.
I'm trying to figure out how to sort a list of artists for a music app I'm writing.
To help understand the database structure: Rather than having a relational system where each song in the songs table has an artist ID that references a row in the artists table, I simply have a list of songs with the artist's name as a string in a column. I then use GROUP BY artist
in a MySQL query to return a list of individual artists.
My app retrieves this data from my server in the form of a JSON-encoded array which is the result of the following MySQL query:
SELECT artist FROM songs GROUP BY artist ORDER BY artist ASC
However, this query results with artists with names like &i, +NURSE, and 2007excalibur2007 being sorted before the alphabetical results (such as AcousticBrony, ClaireAnneCarr, d.notive, etc.).
What I need is the artists whose names begin with numbers and symbols returned after the alphabetically-sorted artist list.
The solution can be PHP-based, but I'd prefer the elegance of it being done in the MySQL query.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…