adelante — 2011-03-31T20:58:57-04:00 — #1
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:
FROM exhibitors WHERE exhibitors.program BETWEEN 'A%' AND 'C%' ORDER BY exhibitors.program
Is there another way to include every record in the range?
r937 — 2011-03-31T22:36:18-04:00 — #2
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
adelante — 2011-04-01T00:31:00-04:00 — #3
Thanks Rudy, that makes perfect sense, problem solved.