Asked by: User57
I have database fields bill_amount
, paid_amount
, due_amount
..if a customer created with bill_amount
, paid_amount
& due_amount
& like 240, 200 & 40. and the next day he cleared the amount ie, paid_amount become 240 & due_amount becomes 0 .
If i tried to get report of daily collection which is daily paid_amount where yesteday paid_amount shouldn't be added .means todays collection should be 40 not 240..How do i track it in sql?
the following sql query returns todays sum of todays paid_amount but it includes the yesterdays amount also..how to exclude the yesterdays paid_amount
for same customer?
$daily_collection_m = DB::select("SELECT sum(transactions.paid_amount) as daily_collection_m FROM transactions
WHERE CAST(transactions.created_at as DATE) ='$day' ;
No comments:
Post a Comment