This was what I was going for, but frankly, you don't even have to escape the _. Just the replace causes it to not match. Order in the join is important.
create or replace table kevin.testlike1 (column1 char(20));
create or replace table kevin.testlike2 (column2 char(20));
insert into kevin.testlike1 values('0110 EXFN 01 ABCD');
insert into kevin.testlike2 values('0110 EXFN 01'),('____ EXFN 01');
select * from kevin.testlike1 t1,
t1.column1 like trim(replace(t2.column2,'_','\_')) concat '%'
On Tue, 2021-10-19 at 13:18 -0500, Justin Taylor wrote:
I got it now. I'd have to replace all % and _ in one column and then
specify the ESCAPE on the LIKE clause.
Unfortunately, the mailing list corrupted the example you copied from the
SQL reference. Let's see if I have better luck.
WHERE C1 LIKE 'AAAA+%BBB%' ESCAPE '+'
date: Tue, 19 Oct 2021 13:10:35 +0000
from: Tim Fathers <tim@xxxxxxxxxxxxx<mailto:tim@xxxxxxxxxxxxx>>
subject: Re: LIKE quandary
You could specify an escape character for the wildcard characters like
WHERE C1 LIKE ?AAAA+%BBB%? ESCAPE ?+?
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Toll Free: 877-893-2550<tel:877-893-2550>
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.