MYSQL: Find a Range
Want to find users whose lastnames start with the letters between A and O?
SELECT * FROM users
WHERE SUBSTR(lastname, 1,1)
BETWEEN ‘A’ AND ‘O’;
Notice SUBSTR is 1 based… annoying!
Second observation, SUBSTR is a 4.1 alias for SUBSTRING so if you aren’t using 4.1+ you’ll want to use SUBSTRING rather than SUBSTR