DB2不支持字符串连接的“+”符号。 使用以下方法之一来获得所需的结果:
with Table1(LocationID, Model, CAMERA) as (values (1, 'Zone A', 'ABCD') , (2, 'Zone B', 'ALI') , (3, 'Zone A', 'JUY') , (4, 'Zone A', 'LOS') , (5, 'Zone C', 'OMG') ) , Table2 (Vehicle, NAME) as (values ('Honda', 'Txx_ss_ABCD') , ('Myvi', 'Tyy_ss_ABCD') , ('Vios', 'Tyy_ss_JUY') , ('Proton', 'Tyy_ss_LOS') , ('SUV', 'Tyb_ss_OMG') , ('SUV', 'UUS_ss_OMG') , ('SUV', 'Lyx_ss_JUY') ) SELECT Vehicle,NAME FROM Table2 INNER JOIN (SELECT CAMERA FROM Table1 WHERE Model LIKE '%Zone A%')sub on NAME LIKE '%'||sub.CAMERA||'%' --concat(concat('%', sub.CAMERA), '%') ;