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 2000 Forums
 SQL Server Development (2000)
 Different types of joins

Author  Topic 

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-05-14 : 11:49:45
Okay, playing with joins in a view. There is very little data on this as far as books online or sites that I can find. we have a table with 2 coloumns (keep it simple). 1 is a primary key the other is a int that links to table 2. table 2 has the primary key (linked to table 1) and a a few data columns.

table 1
pk int1
2,1
3,2
4,2
5,2
6,1
7,1
8,3
9,4
table 2
pk data
1,'hi'
2,'bye'


now a inner join on the 2 tables would give 7 results. Since entries in 8 and 9 in table 1 link to values 3 and 4 which don't exist in table 2, the view won't pick them up.

how are the other joins different? any documentation that will show me how to use left and outer joins for this and what the results would be?


YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-05-14 : 11:56:51
Look in BOL for "Using Joins"
it explains the join types with examples
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-14 : 11:58:42
. . . flip to the index tab in bol and type 'joins' . . . read the sections on 'ANSI','cross','full','FROM clause','hash','inner','merge','outer'.... there is quite a bit out there . . .

On top of that take a look at some of the 85,000 links returned from
http://www.google.com/search?hl=en&q=sql+joins



<O>

Edited by - Page47 on 05/14/2002 11:59:06
Go to Top of Page

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-05-14 : 12:08:44
Found what I need. Funny when I did the search in BOL for joins it brought back a bunch of useless crap but using the tabs got it back to me almost instantly.

Thanks alot guys.. big help ;)



Edited by - M.E. on 05/14/2002 12:10:22
Go to Top of Page
   

- Advertisement -