I have 2 tables, student
and family
.
Half of the students come Sundays, the other half Saturdays
Some families have more than one child.
Families pay fees for the school. Some families because of some critearia have a discount.
"discount" is a field in 'family' table
In a report I need to calculate the sum of all the discounts of all families that take advantage of a discount (by day).
When I do so, if a family has 2 children, the result returns double of the discount, if 3 children 3 x discount....
My Query:
$select_total_discounts =
"SELECT SUM(Discount) AS total_discounts
FROM family, student
WHERE family.Family_ID=student.Family_ID
AND student.Day like '%$Day%' ;" ;
$query= mysql_query($select_total_discounts,$conn) ;
$row = mysql_fetch_assoc($query);
$total_discounts= $row['total_discounts'];
Thank you in advance