Answer the question
In order to leave comments, you need to log in
How to count the number of rows separately in three different tables in one query?
Hello.
The following question arose, I have 3 tables:
track_open, track_link, track_like
They are almost the same in structure, each has an id, user_id, post_id.
I want to count how many total openings, how many likes and transitions each post I need (I want to set several post_id through IN () at once).
And at the same time get something like this:
+---------+--------+------+------+
| post_id | opens | likes | links |
+---------+------- +------+------+
| 55 | 5213 | 123 | 25 |
| 56 | 1263 | 55 | 14 |
+-------- +------- +------+------+
How to make a query correctly?
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