using result as part of regular expression

Started by larry a pricealmost 25 years ago2 messagesgeneral
Jump to latest
#1larry a price
laprice@efn.org

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
_______________________________________________________________

#2Peter Eisentraut
peter_e@gmx.net
In reply to: larry a price (#1)
Re: using result as part of regular expression

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/