I would like to compare table1
and table2
with specified column as string and want to return unmatched records from table1
.
It works great when I use other way just 'like'
and return matching result.
But I am really looking to get unmatched records.
Here is the sample tables
table 1 ---------------------------------- No. DesignID 1 c12345 2 c16 3 c20Table 2 ---------------------- No. DesignOption 1 Online-c12345-print 2 Online-c16-proof
$db->fetchallColumn(SELECT distinct(a.DesignID) FROM table1 as a, table2 as b where b.DesignOption
not like CONCAT('%', a.DesignID, '%'));
with join example
$db->fetchallColumn(SELECT distinct(a.DesignID) FROM table1 as a inner join
table2 as b on b.DesignOption not like CONCAT('%', a.DesignID, '%'));
Expected result: c20
Instead I get all the records from table1