Continue to consult the mysql Query statement: multi-table joint query, how to limit the specific where limit or limit if the table on the right has a corresponding record, otherwise, no restrictions are imposed, such as table 6 joint queries. Currently, a & nbsp; left & nbsp; join & nbsp; B & nbsp; left & nbsp; join & nbsp; c & nbsp; left & nbsp; join & nbsp; d & nbsp; left & nbsp continue to consult mysql Query statement: multi-table joint query, how to restrict tables on the right to specific where or limit restrictions if there is a corresponding record, otherwise no restrictions
Example
6 Table join queries. Currently, a left join B left join c left join d left join e left join f is used.
To ensure that each record in Table a can only find one corresponding record in the bcedf table, some conditions must be added.
However, after a restriction such as where f. aaa in (0, 1, 2, 3) is added, all query results have corresponding records in table f.
How can I modify the statement if no corresponding record exists in table f?
In addition, if another question is asked, even if such a condition is added, the becdf table still has multiple records. can I limit this SQL statement to only query the latest one for table f, to prevent repeated records in Table a from appearing in the results
------ Solution ----------------------
A query result needs to be connected through 6 tables. it should be said that there is a problem with your table design.
You can press the join key to create several transition tables to reduce the impact between tables.
------ Solution ----------------------
6. what is the Cartesian product generated for table queries? I am stuck.
------ Solution ----------------------
1. as I have mentioned above, a transitional table is generated before querying a transitional table.
2. use a view to convert an unreasonable design into a rational design, and query the view.