Thanks Bob. Can you give me an example and why you would use UNION? I do understand the FULL JOIN idea but seldom need it. I'm doing an online T-SQL class and UNION concept is clear as 'mud'!
Pat
This forum looks better than any in US I've seen in a while. Couple of old ones but not getting updates.
Yes, banana, I do understand but still not quite sure " the why" to use it. And I do understand the Outer Join would not do it now, thanks.
Pat
the why?
occasionally you need a set of results based on merging data from two different sources, that cannot otherwise be combined.
SELECT TOP 5 AmtSold, FName FROM SALES ORDER BY AmtSold DESC
UNION
SELECT TOP AmtSold, FName FROM SALES ORDER BY AmtSold ASC
SELECT FName, Sex, DOB, Religion FROM Employee
UNION
SELECT FName, Sex, NULL, NULL FROM EmployeeArchive
My two penn'orth.
I find that in about 80% of cases, the use of a union query indicates that the data is not normalised since it implies that you have two or more datasets with similar structures. Of course, the structure may be dictated by external factors which you cannot change and not simply poor design on your part.
excellent points.I just wanted to add 3 points ... Dallr