Re: Pattern Matching - Range of Letters

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Pattern Matching - Range of Letters
Дата
Msg-id 464373F7.40100@commandprompt.com
обсуждение исходный текст
Ответ на Pattern Matching - Range of Letters  (Ron St-Pierre <ron.pgsql@shaw.ca>)
Список pgsql-general
Ron St-Pierre wrote:
> I'm sure that others have solved this but I can't find anything with my
> (google and archive) searches. I need to retrieve data where the text
> field is within a certain range e.g.
> A-An
> Am-Bc
> Bc-Eg
> ....
> Yi-Zz
>
> Does anyone know of a good approach to achieve this? Should I be looking
> into regular expressions, or maybe converting them to their ascii value
> first?


postgres=# create table test (test text);
CREATE TABLE
postgres=# insert into test values ('A');
INSERT 0 1
postgres=# insert into test values ('b');
INSERT 0 1
postgres=# insert into test values ('c');
INSERT 0 1
postgres=# insert into test values ('d');
INSERT 0 1
postgres=# insert into test values ('e');
INSERT 0 1
postgres=# insert into test values ('Ab');
INSERT 0 1
postgres=# insert into test values ('Ac');
INSERT 0 1
postgres=# insert into test values ('Az');
INSERT 0 1
postgres=# select * from test where test between 'A' and 'An';
  test
------
  A
  Ab
  Ac
(3 rows)



>
> Any comments are appreciated.
>
> postgres 8.2.4, RHEL
>
> Thanks
> Ron St.Pierre
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faq
>


--

       === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


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

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Pattern Matching - Range of Letters
Следующее
От: "John D. Burger"
Дата:
Сообщение: Re: Pattern Matching - Range of Letters