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)
 select query Inner join vs left join

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2013-02-17 : 13:47:11
I am making an inner join in etl job , first table has 7000 rows second table has 12000 rows.

because of inner join i am getting the result output exact 7000 rows, which is first table match count.

How can i get 12000 rows as my result can i just do left join, will it produce 12000 rows as my final result?

This is based on an ETL job, this one element is part of a bigger job which takes almost 7 hrs.

Just would like to have the details then will make the necessary changes.


Thanks a lot for the helpful info.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-17 : 14:06:42
you need to do a left join with bigger table on left side of the join to get 12000 rows

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2013-02-17 : 14:28:08
Thks Visakh, you are an amazing guy
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-17 : 23:22:06
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -