|
veeramaga
Starting Member
5 Posts |
Posted - 10/22/2006 : 00:46:13
|
select distinct p.property_id,count(r.property_id)as total_ region,count(t.property_id) as total_tenant from Property p inner join region r on p.property_id =r.property_id inner join tenant t on r.property_id = t.property_id and p.property_id= 12 group by p.property_id
The above query is to get me the count of region and tenants for each property
in the above query I added 5 rows of property_id as 12,when I execute it separately that is, property table and region table I get 5 as the count which is correct, the same way with property table and tenant table the same 5 as count, but if I run like above, joining 3 tables I get the output of count as 25, why is it?can anyone help me out in finding out the reason?
|
|