I have a table that is designed like this:
tbl_User
id
Name
tbl_User_Payment
id
user_id
amount
status
tbl_User
id Name
001 John Doe
002 Juan Dela Cruz
tbl_User_Payment
id user_id amount status
001 001 10 Successful
002 002 10 Fail
003 001 10 Fail
004 001 10 Fail
005 001 10 Fail
006 002 10 Successful
007 002 10 Fail
008 002 10 Fail
The problem here is that how can I count the number of Failed Payment after a Successful Payment. So the result here should be something like this:
John Doe - 3 Failed Payment
Juan Dela Cruz - 2 Failed Payment
I hope you understand what i'm trying to accomplish here.
Your help will be greatly appreciated and rewarded!
Thanks! :)