I've two temporary table say temp1 and temp2(which are created in runtime). I need to perform "FULL outer JOIN" to get the data from both the table. But I got error
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'FULL OUTER JOIN cashExtTemp t2
ON t1.code = t2.code'
SELECT * FROM cashIntTemp t1 FULL OUTER JOIN cashExtTemp t2 ON t1.code = t2.code
And came to know that FULL OUTER JOIN is NOT possible in MySQL from this link Full Outer Join in MySQL and tried to implement UNION as given in the link. Since I'm using temporary table it doesn't work and i got the error as
Error Number: 1137
Can't reopen table: 't1'
This is my UNION Query
SELECT * FROM cashIntTemp t1 LEFT JOIN cashExtTemp t2 ON t1.code = t2.code
UNION
SELECT * FROM cashIntTemp t1 RIGHT JOIN cashExtTemp t2 ON t1.code = t2.code
The data in the table would be like this TABLE: cashIntTemp
code qty date
P001 100 2013-11-29
P003 200 2013-11-30
P005 600 2013-11-30
The data in the table would be like this TABLE: cashIntTemp
code qty date
P001 110 2013-11-29
P002 250 2013-12-01
P005 650 2013-12-01
I need a query to get all the data from both the tables.
I need the result in this format
code qty date code qty date
P001 100 2013-11-29 P001 110 2013-11-29
P002 250 2013-12-01
P003 200 2013-11-29
P005 600 2013-11-29 P005 650 2013-11-29
So please help me on this. Thanks in advance.