Answer the question
In order to leave comments, you need to log in
How to set SQL query with aggregation from several tables?
Hello. Please tell me how to make a request.
Given:
- table main (id, ...);
- table first (id, id_main, ...) associated with main as many to one;
- table second (id, id_main, ...) associated with main as many to one.
It is required to receive a response of the form:
main.id, count(first.id_main), count(second.id_main).
At me both count all time are multiplied.
Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question