I have two tables users and payments, in payments I have user_id
amount_to_pay
and amount_paid
.
I want to get users who didn't paid full payment, so
if($payments->amount_to_pay < $payments->amount_paid)
{ $unpayments += $amount_to_pay - $amount_paid}
But the problem is that a user has many payments so I need to check how many users didn't paid full subscription.
Please Help