I have a query that is counting records of a certain type in another table, however, when the count is 0, the join type no longer exists either. How do I get it to return a count of 0 if there is no join? The left join brings me nothing.
for example:
This gives me a number of results, but it doesn't give me a 0 for area type if that Name_inst_id doesn't have an S area type... How do I get it to give me 0 for when that join/count doesn't work?
Thanks.
for example:
Code:
Select p.Name, p.Size, p.Start_Area, p.End_Area, count(pt.Area_type) from Places p left outer join Place_types pt on p.name_inst_id = pt.name_inst_id where p.Start_Area = 'SF' and p.Size = 'Medium' and pt.Area_type = 'S' group by p.Name, p.Size, p.Start_Area, p.End_Area
Thanks.
Comment