mrherman Posted September 23, 2008 Share Posted September 23, 2008 Hi, I discovered to my chagrin that MySQL does not do FULL OUTER JOINs. At any rate, after much researching, I have ended up with the code below, in which each of the queries works separately, but when I try to join them with the UNION clause, I receive an error saying that "can't reopen temp2". These are all are temporary tables -- Does that make a difference? SELECT temp1.last_name FROM temp1 LEFT OUTER JOIN temp2 ON temp1.student_id = temp2.student_id UNION SELECT temp2.last_name FROM temp2 LEFT OUTER JOIN temp1 ON temp2.student_id = temp1.student_id ; I've tried parentheses, etc., but nothing has worked yet. Thanks for any advice! Link to comment https://forums.phpfreaks.com/topic/125473-simulating-a-full-outer-join-how/ Share on other sites More sharing options...
Barand Posted September 23, 2008 Share Posted September 23, 2008 With that query you may as well just do SELECT temp1.last_name FROM temp1 UNION SELECT temp2.last_name FROM temp2 Link to comment https://forums.phpfreaks.com/topic/125473-simulating-a-full-outer-join-how/#findComment-649078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.