Three-table join query three tables abc when I connect, I must write a query statement based on table a, but I don't know how to write it. The problem is: if the ID of Table A does not exist in other tables, the query fails. Please give me some advice. The following two SQL statements are left by the former programmer. The last one is modified by me. But three-table join query
Three tables a B c
When connecting, I must write a query statement based on table a, but I don't know how to write it,
The problem is that if the ID of Table A does not exist in other tables, the query will fail.
Please give me some advice.
The following two SQL statements are left by the former programmer.
The last one is modified by me.
But there are problems.
The problem is as follows.
This was left by programmers.
CSS code
SELECT *, SUM (B. nums) AS addsums, SUM (c. nums) AS clicksumsFROM dx_app_info aINNER JOIN 'dx _ app_add_count 'binner JOIN 'dx _ app_click_count 'c ON. app_id = B. app_idAND. app_id = c. app_idWHERE app_name LIKE '% online human biological clock query %' group by. app_id
The problem is that if B or c does not have a corresponding ID, the query will fail. I don't want to see this result.
SELECT *, SUM (B. nums) AS addsums, SUM (c. nums) AS clicksums
FROM dx_app_info
Inner join 'dx _ app_add_count 'B
LEFT[Color = #00FF00] [/color] JOIN 'dx _ app_click_count 'c ON a. app_id = B. app_id
AND a. app_id = c. app_id
WHERE app_name LIKE '% online human biological clock query %'
Group by a. app_id
LIMIT 0, 20
This is the SQL statement I modified,
It can be queried, but the execution time is too long to be accepted.
------ Solution --------------------
Okay, I got it.
------ Solution --------------------
I am also a person...
------ Solution --------------------
Try to avoid having LIKE