Good Day Experts!
I have a SQL issue that I am in need of help with. I have 3 temp tables that have the same structure. I need to join all 3 together. However, all 3 temp tables may or may not have matching records. Temp table 1 may be the same as Temp table 2 and 3. Temp table 1 may not have a match in 2 or 3. It could have a match in 2 but not 3. Essentially, any combination from the 3 tables is possible.
Thinking out loud, if I left join Temp table 2 to Temp table 1 then join Temp table 3, would I then miss out on the records that may or may not have matched between 1 and 3?
Is this possible?
Thanks,
jimbo99999
If you want the results combined, I would look at a UNION or UNION ALL.
If you need some columns from each of the tables like you've joined them, look at a UNION and a PIVOT.
If you want anything more specific, tell us the database type and version then provide sample data and expected results.