mgm_03 Posted October 28, 2006 Share Posted October 28, 2006 I need a query that will retrieve rows based on the first letter of the product name. The user will choose from A-G, H-P, or R-Z (maybe the ranges will be more granular) and I need to return all the products whose name begins with a letter in one of those ranges.I am guessing that a regex is needed but after that I'm clueless. Any advice is appreciated and if there's an explanation somewhere on the web, pls point me there. I'm not sure what to google for.**RESOLVED ***select * from products where name regexp '^[a-g|A-G]' Quote Link to comment https://forums.phpfreaks.com/topic/25423-need-query-to-retrieve-names-whose-first-letter-is-in-a-range-eg-a-h/ Share on other sites More sharing options...
fenway Posted October 28, 2006 Share Posted October 28, 2006 Actually, you don't need to OR, since matches are generally case-insensitive anyway. Quote Link to comment https://forums.phpfreaks.com/topic/25423-need-query-to-retrieve-names-whose-first-letter-is-in-a-range-eg-a-h/#findComment-116077 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.