From: | Antonio Fiol Bonnín <fiol(at)w3ping(dot)com> |
---|---|
To: | joe(at)jwebmedia(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Query Help |
Date: | 2001-12-18 09:35:07 |
Message-ID: | 3C1F0DCB.20805@w3ping.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
For your very particular purpose, you may try to use
----------------
select * from table where substring(column, 0,1) between '0' and '9';
----------------
For a more general purpose, try the ~ operator.
\do will give you a list of available operators
You should maybe care about ~* operator also (case insensitive).
If you need to match one among many regular expressions, you can try to
store them in a little table, and then try:
----------------
select distinct table.* from table, regex_table where table.column ~
regex_table.regex;
----------------
DISTINCT is there to avoid that entries matching multiple regexps appear
multiple times.
No guarantees on performance.
HTH,
Antonio
Joe Koenig wrote:
>Thanks for the responses - I was able to patch something together from
>the responses. On to the next thing - I want to do a search based on a
>reg ex. Does PostgreSQL have something like MySQL's "RLIKE"? I want to
>pull all records in a category that start with a number 0-9. The best
>way I saw was to do a UNION with all the numbers, but I figured there
>was a better way. Thanks,
>
>Joe
>
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2001-12-18 09:39:40 | Re: querying for specs? |
Previous Message | Tina Messmann | 2001-12-18 09:32:21 | enumeration type? |