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
 Old Forums
 CLOSED - General SQL Server
 getting wrong counts...

Author  Topic 

brendita
Starting Member

38 Posts

Posted - 2005-09-15 : 18:56:14
select count(*) from DRateII = 828

select count(*) from TEQS.dbo.tblEqDerateCl2 = 1623

select count(*) from DRateII d
left join TEQS.dbo.tblEqDerateCl2 d2
on d.model = d2.model = 8766

Can anyone tell me why these numbers are possible? Shouldn't it just pull 828 when I join them?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-15 : 18:58:25
How many rows does it pull if you use INNER JOIN? Do you understand the difference between INNER JOIN and LEFT OUTER JOIN?

LEFT JOIN means you are getting the matches from your ON condition plus all the unmatches from the left table. INNER JOIN is matches only.

Tara
Go to Top of Page

brendita
Starting Member

38 Posts

Posted - 2005-09-15 : 20:23:19
An INNER JOIN gives me the same results. Why would that be?
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-09-15 : 20:53:00
quote:
Originally posted by brendita

An INNER JOIN gives me the same results. Why would that be?



you have a many to many relationship.




-ec
Go to Top of Page
   

- Advertisement -