skeezmo Posted July 31, 2006 Share Posted July 31, 2006 Hello,I have a large list of songs and artists and I am creating a playlist. At the top, I have the user select a letter which will then direct them to artists that start with that letter.The problem I am running into is for artists that start with a number should be going under a separate category [b]0-9 and '[/b]. But instead they are going as individual numbers in the list.The query I am running for this is: [code]SELECT distinct substr(artist, 1,1) as browse FROM songlist WHERE songtype = "S" or songtype = "C" ORDER by artist asc[/code]I have tried adding into the where clause AND songlist.browse not like '1%') etc.My question is, can I run a query and exclude numbers from returning in the result?Does anyone have any suggestions that I could use to accomplish this?Thank you in advance to anyone who may be of help.Hess Smith Quote Link to comment Share on other sites More sharing options...
fenway Posted August 2, 2006 Share Posted August 2, 2006 You should probably be able to use a regex and exlude the appropriate character class (UNTESTED):[code]SELECT distinct substr(artist, 1,1) as browse FROM songlist WHERE songtype = "S" or songtype = "C" AND LEFT(artist,1) REGEXP "^[0-9']" ORDER by artist asc[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.