The long-awaited reader, the first poster is here.
I am trying to figure out how to sort the artist list for the music application that I am writing.
To understand the structure of the database: instead of having a relational system in which each song in the song table has an artist identifier that refers to a line in the artist table, I just have a list of songs with the artist name as a line in the column. Then I use GROUP BY artistMySQL in the query to return a list of individual artists.
My application retrieves this data from my server as 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 causes artists with names like & i, + NURSE and 2007excalibur2007 to sort before alphabetical results (such as AcousticBrony, ClaireAnneCarr, d.notive, etc.).
I need artists whose names begin with numbers and characters returned after a list sorted in alphabetical order.
The solution may be based on PHP, but I would prefer that its elegance be executed in a MySQL query.
source
share