How do you query a range of letters

I’m a little bit stuck on a query, I want to get a range of records where the first letter of the field is between A-C and D-F … A-Z,

I’ve tried the between operator but find that records with the last letter of the range are omitted. No problem I thought just extend the range to the next letter but what happens when I get to the letter Z?

This is the query I’m using:

SELECT *
FROM exhibitors WHERE exhibitors.program BETWEEN 'A%' AND 'C%' ORDER BY exhibitors.program

Is there another way to include every record in the range?

you shouldn’t have those wildcard percents in there, those are only for LIKE comparisons

try this –

WHERE exhibitors.program >= ‘A’ AND exhibitors.program < ‘D’ – gives A to C inclusive

WHERE exhibitors.program >= ‘D’ AND exhibitors.program < ‘G’ – gives D to F inclusive

WHERE exhibitors.program >= ‘W’ – gives W to Z inclusive

:slight_smile:

Thanks Rudy, that makes perfect sense, problem solved.