SELECT t1.`id` FROM `bd1`.`table1` t1 LEFT JOIN `bd2`.`table2` t2 ON t1.`id` = t2.`id` WHERE t2.`id` IS NULL ORDER BY t1.`id` ASC