I want to use something like:
SELECT A.* FROM MYSCHEMA.MYTABLE A, MYSCHEMA.SECONDTAB B WHERE A.COL1 LIKE B.COL1 || '%'
How to achieve this in DB2 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not so sure what you try to achieve but it works in DB2. Just add TRIM function at
LIKE TRIM(B.COL1) || '%'or swap it toWHERE B.COL1 LIKE TRIM(A.COL1) || '%'[edit]
Above works in DB2 in as/400(or whatever name they call it right now)
Below might work with DB2 LUW (tested with DB2 windows v8.2), assuming COL1 type = varchar