> What I'd like to do is pull a list of records where there is a range
> of last names; say from A - F.
> select * from table where last_name LIKE 'A%' AND last_name LIKE 'F%'
> - for example.
>
> The above code I've tried for this doesn't seem to work as I'd expect
> it too?
When you use the AND boolean operator, you are asking for records that match
BOTH boolean expressions. And I don't know many words that start with A
*and* F. :)
You want to use the OR operator:
SELECT * FROM table_name WHERE last_name LIKE 'A%' OR last_name LIKE 'F%'
> Can anyone provide some details or insights on how to accomplish this?
If you want a range, you'll have to use a regular expression (or a whole
bunch of LIKE expressions for every value in the range. A regular expression
version would be:
SELECT * FROM table_name WHERE last_name ~ '^[A-F]'
The tilde (~) tells it to match on a regular expression, the carat (^) tells
it to match the beginning of the string, the brackets match a single
character, and the A-F matches one letter in that range.
Hope this helps!
Greg