Re: Query Help
От | Antonio Fiol Bonnín |
---|---|
Тема | Re: Query Help |
Дата | |
Msg-id | 3C1F0DCB.20805@w3ping.com обсуждение исходный текст |
Ответ на | Re: Query Help (Chris Albertson <chrisalbertson90278@yahoo.com>) |
Список | 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 >
В списке pgsql-general по дате отправления: