Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Union All or Full Join?

Author  Topic 

lici
Starting Member

11 Posts

Posted - 2005-02-07 : 15:45:07
Hi!!
Somebady can tell me what is the difference between full join and union all?
or, where i can find information about it?


Tnx a lot

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-02-07 : 15:46:37
Books Online

Semper fi,

Xerxes, USMC (Ret)
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-02-07 : 15:50:08
First off, the difference between UNION and UNION ALL are simple: UNION eliminates duplicates. As for a 'FULL JOIN'....do you mean left outer or right outer?

Semper fi,

Xerxes, USMC (Ret)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-02-07 : 16:17:50
Xerxes,

Full outer join is different than left outer and right outer.

Here's the description for full outer join:

quote:


A full outer join returns all rows in both the left and right tables. Any time a row has no match in the other table, the select list columns from the other table contain null values. When there is a match between the tables, the entire result set row contains data values from the base tables.




Tara
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-02-07 : 16:22:22
They are very different, but both can be used for similiar purposes. (i.e., to find unmatched rows in two tables in either direction)

I recommend, personally, to use UNION ALL and to avoid FULL JOINS -- FULL JOINS (much like RIGHT JOINS) aren't very logically sound when designing a clearly defined SELECT statement.

- Jeff
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-02-07 : 16:23:55
Tara & Jeff,

Thanks again for clarifying. I personally like UNION ALLs, too.

Semper fi,

Xerxes, USMC (Ret)
Go to Top of Page
   

- Advertisement -