Search code examples
mysqldatabaseselectrangestartswith

How do I select by a range of starting characters?


Here is my mySQL query:

SELECT *
FROM `eodList` 
WHERE datechanged>='$curdate' 
GROUP BY symbolName 
ORDER BY dateChanged DESC

How do I get all rows (for example) where symbolName starts with letters A-F?


Update:

I need something that can be easily changed to another range without alot of code changes.


Solution

  • Try with Regex

    WHERE symbolName REGEXP '^[A-F]'