In Ihrem Fall sollten Sie so etwas wie
verwenden$query = $db->prepare('(SELECT last_visit,
last_ip
FROM user_log
WHERE user_id = :id_1
)
UNION
(SELECT time AS last_visit,
packet_hex AS last_ip
FROM crack_log
WHERE target_id = :id_2
)
ORDER BY last_visit DESC LIMIT 0,10;'
);
$query->execute(array(':id_1'=> $_SESSION['id'],
':id_2'=> $_SESSION['id']
)
);