Let's say I have the following query to list the average value of a house people own:
SELECT PERSON.NAME, AVG
FROM PERSON, (
SELECT HOUSE.PID AS PID, AVG(HOUSE.VALUE) as AVG
FROM HOUSE
GROUP BY PID
) HOUSES
WHERE PERSON.PID = HOUSES.PID OR PERSON.ID NOT IN (
SELECT PID
FROM HOUSE
)
The query does what I want it to do, except it doesn't include the people who don't have any houses, who should have "0" as their house cost average.
Is this possible, or am I way off?