Sry if im just being blind, but this does make no sense, because I always did write it like this and I and see anything wrong with it. Besides I used multiple SQL solutions bit still errors in syntax...
My php code here:
$sql1 = " SELECT table1.file_name, table2.path
FROM table1 AS t1
LEFT JOIN table2 AS t2
ON t1.file_name = t2.path
WHERE t2.path IS NULL OR t1.file_name <> t2.file_name OR t1.file_name <> t2.path";
$sql2 = "INSERT INTO table3 (file_name) VALUES(".$sql1.")";
Shopware()->Db()->query($sql2);
My error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT table1.file_name, table2.path FROM (the first 2 letters of table1)' at line 1 in Zend\Db\Statement\Pdo.php on line 234