How To Join, If The Text Contains
I have 2 tables, say table A has 10 rows and table B has 100 rows and I want to perform a join, but the matching condition has to be where a column from A 'is like' a column from B
Solution 1:
From the HANA documenation for CONCAT it appears that CONCAT() only takes two parameters, not three or more. You can workaround this by just nesting two calls to CONCAT():
SELECT *
FROM TABLE_a JOIN TABLE_b
ON b.column LIKE CONCAT('%', CONCAT(a.column, '%'));
Solution 2:
SELECT a.employee_id
FROM employees a
JOIN departments b
ON a.department_id LIKE '%'
||a.department_id
|| '%';
Post a Comment for "How To Join, If The Text Contains"