Jump to content

Simulating a FULL OUTER JOIN -- How?


mrherman

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.