USE hahn;
$manual_pool = 'home/intrasearch/analytics/manual_pool/current';
$new = SELECT * FROM $manual_pool;

$t1 = SELECT * FROM
(SELECT query, factors, rating, url FROM {{input1}}) as old
LEFT ONLY JOIN
(SELECT query, url FROM $new) as new
using(query, url);

$t2 = SELECT * FROM
(SELECT query, factors, url  FROM {{input1}}) as old
INNER JOIN
(SELECT * FROM $new) as new
using(query, url);

INSERT INTO {{output1}} 
SELECT * FROM $t1
UNION ALL
SELECT * FROM $t2;