Hi there. I'm looking for a query to select rows from two different tables, keeping the column names the same (I did find one result here for selecting from two different tables, but it merged the column names to have an easier query). I need to keep the original column names, but have two different tables existing within the new, larger table. There are no overlapping columns between the two tables.
A picture, to visualise:
So, how can I do this? I know the query will probably be quite convoluted, but anything half-decent is probably going to be better than my current attempt:
SELECT t1.* , t2.*
FROM table1 t1 RIGHT OUTER JOIN table2 t2
ON r.someColumn1 = rc.someColumn2
UNION
SELECT t1.* , t2.*
FROM table1 t1 LEFT OUTER JOIN table2 t2
ON r.someColumn1 = rc.someColumn2
This does work, but only as long as there are no cases where someColumn1 = someColumn2 - which can happen quite easily, of course.
Any help is appreciated, and I apologise for what is probably a very silly question to which the smart answer is "don't do it, you fool!".