I have two tables, one of clients and other charges, I wanted to know how to return only clients with two charges in arrears? Winning something like ‘charges.date < \’’ . date(‘Y-m-d’) . ‘\’’
I have two tables, one of clients and other charges, I wanted to know how to return only clients with two charges in arrears? Winning something like ‘charges.date < \’’ . date(‘Y-m-d’) . ‘\’’
You can add something like this to your query:
WHERE (SELECT count(*) FROM charges WHERE charges.client_id = client.id AND charges.date < " . $arrears _date . ") = 2)
Thanks for your reply.in the first case I could do, but our system has two forms of payment in the two different tables, and I want to check in or other charges has expired, if one of them has returned the client, but is not working this way. I believe the problem is with "with", if you have no corresponding "cobrancas" the condition does not return even if you have "boletos" corresponding to condition. Could you help me? I thank you.