SELECT Clients.lname, Clients.fname ;
FROM myDatabase!clients ;
WHERE Clients.id_client NOT IN ;
(SELECT Payments.id_client FROM Payments ;
WHERE Payments.Payment > 0 AND ;
Payments. < month and year are the ones I want > ) ;
ORDER BY Clients.lname
This tells you the clients who are NOT IN the group of clients that meets your selection criteria.
>Hi all,
>
>I have two tables, both are relationed,(one-to-many).One contains clients and the other payments. Now, how can I search clients that haven´t yet paid in the current month and in the current year the monthly fee ?
>
>Is it correct ?
>
>SELECT Clients.lname, Clients.fname, Payments.date;
> FROM myDatabase!clients INNER JOIN myDatabase!payments ;
> ON Clients.id_client = Payments.id_client;
> WHERE Clients.id_client NOT IN (Payments.id_client);
> AND (Payments.month_cancelled = ?cMonth;
> AND Payments.year = ?cYear);
> GROUP BY Clients.lname;
> ORDER BY Clients.lname