Re: a problem with sum()

2003-01-01 Thread Adolfo Bello
By looking at your query and table description, I guess you can try something like: SELECT cus.`Code` AS `Customer Code`, cus.`Name` AS `Customer`,SUM((1-bil.direction)*bil.Total) AS Loan, SUM(bil.direction*bil.Total) AS Credit FROM customer AS cus, bill AS bil WHERE bil.`Customer` = cus.`ID` GRO

a problem with sum()

2003-01-01 Thread Aziz Durmaz
Hi, I have got 2 tables one of the is "customers" the other is "bill". In the customers table i store my customers informations. In the bill table i store my billings. if i take a bill bill.direction=0, if i give a bill bill.direction=1. And now i must take a report Like This.. Customer Code