Answer the question
In order to leave comments, you need to log in
How to organize a complex query?
There are 2 tables clients and orders, you need to make a query that will display the name and id of the client, whose number of applications is more than 3. The difficulty is that in orders each order has an id_clients field and these id_clients are repeated, you must first calculate how many repeated id_clients and display only those who have more than 3 repetitions.
Answer the question
In order to leave comments, you need to log in
More or less like this
SELECT c.id, c.name FROM orders AS o INNER JOIN clients c ON o.id_client=c.id GROUP BY o.id_client HAVING count(o.id_client) > 3
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question