UPDATE table2
INNER JOIN (SELECT a.region,a.host
FROM ftpup a
, ( SELECT info,type,timestamp, max(date) as time FROM ftpup GROUP BY type ) b
WHERE a.type = b.type AND a.date = b.time AND a.status <> '0' ORDER BY a.`date` DESC) AS table1
ON (table2.hostname = table1.host AND table2.region = table1.region)
SET table2.status=2