select * from table where last_name ~ '^[A-F]';
or
select * from table where last_name between 'A' and 'G';
or
select * from table where last_name ='A' and last_name'G'
The second one is broken if last_name='G' returns something.
Use ~* in first example to ignore case.
Frank
At 08:16 PM 4/26/01 GMT, you wrote:
H-
I've found the docs on how to select a list of rows from a table were
all the records have a last name starting with 'W%'.
select * from table where last_name LIKE 'W%'
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?
I've even done
select * from table where last_name LIKE 'A%' AND LIKE 'F%'
Can anyone provide some details or insights on how to accomplish this?
Thanks. Much appreciated.
-Steagus
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster