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 2008 Forums
 Transact-SQL (2008)
 join two table

Author  Topic 

padrone
Starting Member

2 Posts

Posted - 2011-06-03 : 17:02:10
hi
let's assume we have two tables (t1,t2) like below


how we can retrieve table t3 in a query?
sorry for my bad English
thanks 4 your help!

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-03 : 17:59:48
[code]
select
isnull(t1.id,t2.id) as ID,
t1.sum1,
t2.sum2
from
t1
full join t2 on t1.id = t2.id[/code]It is the full outer join that lets you get data from one table even when there is no matching data in the other table.
Go to Top of Page

padrone
Starting Member

2 Posts

Posted - 2011-06-03 : 18:27:02
worked
thanks dude
Go to Top of Page
   

- Advertisement -