SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Join with 2 other tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

18 Posts

Posted - 04/18/2013 :  22:09:58  Show Profile  Reply with Quote
I need to Join table t1 with t2 and t3

select a,b,c ,d from t1
left join t2 on t1.a = t2.a
left join t3 on t1.b =t3.b

I am getting too many records . Total records should only the number of records in t1. What am I doing wrong?

The Chadinator

1974 Posts

Posted - 04/19/2013 :  00:10:31  Show Profile  Visit chadmat's Homepage  Reply with Quote
Not necessarily. If there are multiple rows in t2 or t3 with the same join value, you will get a row for each one.

Post sample data.

Go to Top of Page

Starting Member

18 Posts

Posted - 04/19/2013 :  07:22:23  Show Profile  Reply with Quote

Thanks Chad!
That was it . One of the joining tables had multiple rows !
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000