Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL LIKE Column Value Plus Wildcard DB2

I'm trying to use a column and a wildcard in a LIKE clause. I was expecting this to work:

WHERE COLUMNA LIKE '%'||COLUMNB||'%'

Is this supported in DB2?

like image 581
Paul Avatar asked Oct 24 '25 04:10

Paul


1 Answers

Should be able to use the locate syntax (http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.sqlref/fsubstr.htm)

WHERE LOCATE(COLUMNB,COLUMNA) > 0
like image 198
Andrew Avatar answered Oct 26 '25 15:10

Andrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!