Обсуждение: using result as part of regular expression

Поиск
Список
Период
Сортировка

using result as part of regular expression

От
larry a price
Дата:
what i want to do is relatively simple, i have two tables which have some
information in common except that the 2nd table's name attribute was
truncated and is in lower case.

what i'd like to be able to do is something like

SELECT table1.name,table2.web,table2.email
WHERE table1.name LIKE upper(table2.name).'%';
                    ^^^^^^ trying for
                    'content%'
in other words if table2.name is 'Some Charitable Org' i'd want to pass it
to the comparison function as 'SOME CHARITABLE ORG%' so it would match
'SOME CHARITABLE ORGANISATION' in table1.name.

I've been looking through the docs and the book (momjian) but can't seem
to find the bit of syntax i need.

Thanks in advance,
larry

Larry Price      |  "We have seen the truth.
laprice@efn.org  |   And the truth makes no sense." -chesterton
_______________________________________________________________



Re: using result as part of regular expression

От
Peter Eisentraut
Дата:
larry a price writes:

> SELECT table1.name,table2.web,table2.email
> WHERE table1.name LIKE upper(table2.name).'%';
>                     ^^^^^^ trying for
>                     'content%'

|| is the operator for string concatenation.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/