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 with 2 other tables

Author  Topic 

nilaavu
Starting Member

18 Posts

Posted - 2013-04-18 : 22:09:58
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?

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-19 : 00:10:31
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.

-Chad
Go to Top of Page

nilaavu
Starting Member

18 Posts

Posted - 2013-04-19 : 07:22:23

Thanks Chad!
That was it . One of the joining tables had multiple rows !
Go to Top of Page
   

- Advertisement -