Re: SQL Where Like - Range it?!

Поиск
Список
Период
Сортировка
От will trillich
Тема Re: SQL Where Like - Range it?!
Дата
Msg-id 20010427160047.A26644@serensoft.com
обсуждение исходный текст
Ответ на Re: SQL Where Like - Range it?!  ("Len Morgan" <len-morgan@crcom.net>)
Ответы Re: SQL Where Like - Range it?!  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Список pgsql-general
On Fri, Apr 27, 2001 at 09:52:26AM -0500, Len Morgan wrote:
> >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?
>
> SELECT * FROM table WHERE last_name BETWEEN 'A' AND 'Fzzzzzzzzzzzzz' ;
> worked for me.
>
> You could also use BETWEEN 'A' AND 'G' to avoid all of the zzzzzzzzs at the
> end.  Crude but effective.

how about regex?

    select * from tbl where fld ~ '^[A-F]';

--
don't visit this page. it's bad for you. take my expert word for it.
http://www.salon.com/people/col/pagl/2001/03/21/spring/index1.html

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

В списке pgsql-general по дате отправления:

Предыдущее
От: Vince Vielhaber
Дата:
Сообщение: Re: [HACKERS] While we're on the subject of searches...
Следующее
От: will trillich
Дата:
Сообщение: Re: last comma inside "CREATE TABLE ()" statements