Title
6 Table union query, the current use is still a LEFT join B right join C to a LEFT join D to a LEFT join E to a LEFT join F such
In order to ensure that each record in table A is found in the BCEDF table, there are only a few conditions to add.
However, after the restrictions such as where f.aaa in (0, 1, 2, 3) are added, the results of the query are all of the corresponding records in the F table.
I hope we can find out how to modify the statement without the corresponding record in F table.
Another question to ask is that if you add such a condition, there are still more than one becdf in the table, can you limit the number of entries in this SQL statement, such as the F table, to check only the latest, to prevent a table record from repeating in the results
Reply to discussion (solution)
A result needs to be connected through 6 tables, it should be said that your table design has a problem
Several transition tables can be formed by association keys to reduce the impact between tables
6 Table Query, this produces how much Cartesian product ah, anyway, I was stuck dead
Because you want to generate a real-time report ... So the business involved more ...
Of course, this must be a problem with the pre-design, but there's no way to reinvent it.
1, I have said above, the query to create a transition table, and then the Transition table query
2, through the view of the original unreasonable design into a reasonable design, query views for
Resolved add f.id is null