Hi,
I have this query that works fine,
select a.`group name`,a.umbrella_premium,a.money_received,sum(d.amount_paid)
from schedule_premiums a,groups c
left outer join claim_payment_new d
on c.`group name` = d.`group name`
where a.`group name` = c.`group name`
and c.`group name` = b.`group name`
and c.`date deleted` is null
and a.month = '2005-09-01'
and d.date_paid = '2005-09-01'
group by a.`group name`
but then I want to add a count from another table, and when I do that it increases the sum(d.amount_paid) almost four times. Why is that??
select a.`group name`,a.umbrella_premium,a.money_received,sum(d.amount_paid),count(*)
from schedule_premiums a,groups c,productioncalc b
left outer join claim_payment_new d
on c.`group name` = d.`group name`
where a.`group name` = c.`group name`
and c.`group name` = b.`group name`
and c.`date deleted` is null
and a.month = '2005-09-01'
and d.date_paid = '2005-09-01'
group by a.`group name`
I have this query that works fine,
select a.`group name`,a.umbrella_premium,a.money_received,sum(d.amount_paid)
from schedule_premiums a,groups c
left outer join claim_payment_new d
on c.`group name` = d.`group name`
where a.`group name` = c.`group name`
and c.`group name` = b.`group name`
and c.`date deleted` is null
and a.month = '2005-09-01'
and d.date_paid = '2005-09-01'
group by a.`group name`
but then I want to add a count from another table, and when I do that it increases the sum(d.amount_paid) almost four times. Why is that??
select a.`group name`,a.umbrella_premium,a.money_received,sum(d.amount_paid),count(*)
from schedule_premiums a,groups c,productioncalc b
left outer join claim_payment_new d
on c.`group name` = d.`group name`
where a.`group name` = c.`group name`
and c.`group name` = b.`group name`
and c.`date deleted` is null
and a.month = '2005-09-01'
and d.date_paid = '2005-09-01'
group by a.`group name`