Home > database >  For help, on the left after the connection is not the result, want to ask these differences join que
For help, on the left after the connection is not the result, want to ask these differences join que

Time:09-16

The query SQL:
SELECT
Count (1)
The FROM
Table 1 d
LEFT the JOIN
(
SELECT * from table 2
) ON table 2. A field 1=table 1. 2

Left after the join table way:
1, left the join table name
2, and left the join (select * from table name)
3, left the join (selec * from table name limit 0999 99) amount of data in the table is less than 99999

These three join queries, the situation is the first and the second query not to come out, and the third can query,
And: the day before yesterday, not the first, the second line, found yesterday, the second is also not line, but the first and the third, then chose the third,
So, now want to know the difference between them, when the number of database is becoming more and more data need to be modified, after the limit is not desirable,
Trouble you take a look at this problem, is there any solution or way of thinking, thank you!

CodePudding user response:

SELECT
Count (1)
The FROM
Table 1 d
LEFT the JOIN
Table 2
ON table 2. A field 1=table 1. Field 2

CodePudding user response:

1, 2 kinds of effect, but it is not recommended by the second way to write, and the third is associated with a table 1 in table 2 of article 99999 before the data, the general situation is due to the special requirements to write, if the query slow suggested in table 2. The field 1, table 1. Add index field 2

CodePudding user response:

The second, third, don't use efficiency is extremely low, is not in conformity with the specification, ali even tape also query==; You mean the second volume of data in the table is larger? You try

SELECT
Count (1)
The FROM
Table 1

Didn't even and you together and see what's the difference
  • Related