Boo-urns Posted May 2, 2008 Share Posted May 2, 2008 I was wondering what the method would be to skip certain characters in a sort by? SELECT name FROM foods WHERE viewable='Y' ORDER BY name ASC How would i skip it if the first character in the name column starts with a quote or numbers to skip to their first character? Thanks for your help! Corey Quote Link to comment Share on other sites More sharing options...
ucffool Posted May 2, 2008 Share Posted May 2, 2008 Could you simply just do that query and then process the results for what you want? Or is it that your query will be astronomically large with the extra items? Secondarily, if there is something unique about the entries that start with a quote or numbers, you could add an extra column to the table like 'type' and then make your WHERE class also check this 'type' category for a match as well as your viewable='Y'. Quote Link to comment Share on other sites More sharing options...
Boo-urns Posted May 2, 2008 Author Share Posted May 2, 2008 Hmmm... The first option might work bascially what I will be doing with the data being presented is to paginate all of them and there are over 2000 rows so I don't know how quick that would be. I wasn't sure if there was a mysql function or term that I could use that I was unaware of. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 2, 2008 Share Posted May 2, 2008 Do you know which ones you want to skip? Quote Link to comment Share on other sites More sharing options...
Boo-urns Posted May 2, 2008 Author Share Posted May 2, 2008 Any non alphabetical characters mainly so like 08 food1 skip to the f in food. or "food" skip the quotes. Quote Link to comment Share on other sites More sharing options...
fenway Posted May 2, 2008 Share Posted May 2, 2008 Then REPLACE() the characters you don't want, and then order by that. Quote Link to comment Share on other sites More sharing options...
Boo-urns Posted May 2, 2008 Author Share Posted May 2, 2008 Thanks fenway! 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.