Runing DB2, Mainframe, V7
SELECT
T.MERCH_NM
, ORD.ORDER_NM
FROM
(SELECT
ACCT_NBR
, UCASE('''' || '%' || RTRIM(O.MERCH_NM) || '%' || '''')
AS "ORDER_NM"
FROM
ORDER O
WHERE
O.ACCT_NBR = 'ABC' )
AS ORD
, TRANSACTION T
WHERE
T.ACCT_NBR = ORD.ACCT_NBR
AND UCASE(T.MERCH_NM) LIKE ORD.ORDER_NM
DB2 is having an issue with the LIKE statement.
I want to say T.MERCH_NM LIKE '%O.MERCH_NM%', but use the value of O.MERCH_NM, not the string "O.MERCH_NM".
You cannot do nested statements with LIKE (why not IBM....?).
Is there another way to do a contains?? Any thoughts?