SQL query ?

Community Forums/General Help/SQL query ?

Basil(Posted 2010) [#1]
Anyone know how to set a sql query to allow only entries in alphabetic ranges, i.e. entries starting with the letters a-h only?

I assume I'll need to use LIKE somehow but don't know what query string will achive this.

Thanks
Basil


Happy Sammy(Posted 2010) [#2]
select * from file where entry >= "a0000" and entry <= "h0000"


GfK(Posted 2010) [#3]
SELECT * FROM table WHERE name BETWEEN "a%" AND "hz%"

If you were to instead use:
SELECT * FROM table WHERE name BETWEEN "a%" AND "h%"
...then no results beginning with H would be returned.


Basil(Posted 2010) [#4]
Thanks for the help. I worked it out in the end using

WHERE name LIKE '[a-h]%';

Cheers
Basil