General information
Forum:
Microsoft SQL Server
Title:
RIght outer join Problems
Environment versions
SQL Server:
SQL Server 2000
I am trying to create a select statement in Query Analyzer to join two tables together and get all of the rows from the second table and the matching rows from the first table. Here is what I have come up with:
select b.township, b.range, b.section, b.stand, a.a, a.b, a.c, a.d, a.e, a.g, a.h, a.j,
a.k, a.l, a.m, a.n, a.o, a.p, a.s, a.t, a.w, a.hardwood, a.softwood, a.total
from lis_vol a right join InvStds b on
a.township+a.range+a.section+a.stand = b.township+b.range+b.section+b.stand
order by b.township+b.range+b.section+b.stand
The problems I am having is that it returns 9009 rows instead of 8999 which is the row count in the right table. In theory it should only return 8999 rows. What am I missing?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only