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.
Author |
Topic |
1821
Starting Member
18 Posts |
Posted - 2011-12-27 : 06:47:34
|
Hi guys,I have a table with two columns I am selecting from and some of the data in the second column has a reference that I need to use in order to gain data from another column in a different table.The issue is that when I do the join it limits the fields returned but I would like to return everything. Can this be achieved with a different type of join?Thanks |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-12-27 : 06:51:35
|
Can you post the query that you are using? Also, post the table DDL if you can. It may be that you need a LEFT join instead of a simple (INNER) JOIN. But, hard to tell without seeing your current query.If you need help in getting the DDL etc. and a little bit of guidance on how to post, look up Brett's blog here: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-27 : 06:51:56
|
yep...it can be achieved by using left join instead of inner join. it will return all from master table(left had side) and matches in case it has one from right side and otherwise it returns NULL values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
1821
Starting Member
18 Posts |
Posted - 2011-12-27 : 07:25:25
|
Hi guys,Thanks for the advice - the left join is exactly what I needed!Thanks again! |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-27 : 07:33:42
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|