Home All Groups Group Topic Archive Search About

Problem to understand a select question

Author
1 Jul 2005 11:01 PM
Tony Johansson
Hello!

Some background we have two tables one Person and one Car.
The relation is that one Person can own one or at most two cars.
How should the number 198898 and 114388 be understood.
What information does these two numbers give.

I have a select question that looks like this
SELECT COUNT(DISTINCT P.PersonID), COUNT(DISTINCT B.BilID)
FROM Person P FULL OUTER JOIN Bil B ON P.PersonID = B.PersonID
WHERE B.BilID IS NULL OR P.PersonID IS NULL
---------------  --------------------
198898                    114388

(1 row(s) affected)

Many thanks!!

//Tony

Author
2 Jul 2005 4:19 AM
Stu
198898 is the number of distinct person ID's that do not match a record
in the Bil table (using PersonID).  114388 is the number of distinct
BilID's that come from rows with PersonID's that do not match any
PersonID's in the Person table.

Stu

AddThis Social Bookmark Button