mysql query matching multiple elements from a single table
You can't have anything about the inner tables in the WHERE clause for the outer joins to work as expected - move those to JOIN conditions
You would need FULL JOIN which is something that MySQL sadly doesn't support - you can emulate FULL JOIN with two outer joins and UNION




 SELECT 
    a.`cust`
   ,a.`type`
   ,IF(a.`data1`=b.`data1`,a.`data1`,CONCAT("&lt;&lt; ",a.`data1`," &gt;&gt;")) AS 'data1'
   ,IF(a.`data2`=b.`data2`,a.`data2`,CONCAT("&lt;&lt; ",a.`data2`," &gt;&gt;")) AS 'data2'
   ,a.`data2`,
   IF(a.`data1`=b.`data1` AND a.`data2`=b.`data2`,'MATCH','NO MATCH') AS Matched
   ,b.`cust`
   ,b.`type`
   ,IF(b.`data1`=a.`data1`,b.`data1`,CONCAT("&lt;&lt; ",b.`data1`," &gt;&gt;")) AS 'data1'
   ,IF(b.`data2`=a.`data2`,b.`data2`,CONCAT("&lt;&lt; ",b.`data2`," &gt;&gt;")) AS 'data2'
FROM `test`.`tab1` a
LEFT OUTER JOIN `test`.`tab1` b ON (a.`type`=b.`type`) AND (a.`data1`=b.`data1` OR a.`data2`=b.`data2`) AND b.`cust` = 200
WHERE 1=1 AND a.`cust` = 100
UNION
 SELECT 
    a.`cust`
   ,a.`type`
   ,IF(a.`data1`=b.`data1`,a.`data1`,CONCAT("&lt;&lt; ",a.`data1`," &gt;&gt;")) AS 'data1'
   ,IF(a.`data2`=b.`data2`,a.`data2`,CONCAT("&lt;&lt; ",a.`data2`," &gt;&gt;")) AS 'data2'
   ,a.`data2`,
   IF(a.`data1`=b.`data1` AND a.`data2`=b.`data2`,'MATCH','NO MATCH') AS Matched
   ,b.`cust`
   ,b.`type`
   ,IF(b.`data1`=a.`data1`,b.`data1`,CONCAT("&lt;&lt; ",b.`data1`," &gt;&gt;")) AS 'data1'
   ,IF(b.`data2`=a.`data2`,b.`data2`,CONCAT("&lt;&lt; ",b.`data2`," &gt;&gt;")) AS 'data2'
FROM `test`.`tab1` a
RIGHT OUTER JOIN `test`.`tab1` b ON (a.`type`=b.`type`) AND (a.`data1`=b.`data1` OR a.`data2`=b.`data2`) AND a.`cust` = 100
WHERE 1=1
AND b.`cust` = 200;