The left Outer Join adds unmatched data in the master table based on the equijoin. This afternoon, I processed an SQL statement and joined the table through leftouterjoin (soasrightleftouterjoin. seeing this syntax, intuitively, the number of query results should be the number of records returned by the master table after Where (The Where description is omitted below) until today
The left Outer Join adds unmatched data in the master table based on the equijoin. This afternoon, I processed an SQL statement and joined the table through left outer join (so as right left outer join. seeing this syntax, intuitively, the number of query results should be the number of records returned by the master table after Where (The Where description is omitted below) until today
The left Outer Join adds unmatched data in the master table based on the equijoin.
This afternoon, I processed an SQL statement and joined the table through left outer join (so as right left outer join. seeing this syntax, intuitively, the number of query results should be the number of records returned by the master table after Where (The Where description is omitted below), until this afternoon I wrote an SQL statement, the total number of returned records table has more than the total number table. nini!
I think it's a bit unacceptable, why? The reference materials did not fully understand why, and I did not understand why after searching for half a day of data.
So the buddy next to him talked about it. The Buddy looked at it and said, have you considered repeated sub-table records! Instantly understood ....
Summary:
CREATE TABLE a( A INT)CREATE TABLE ab( B INT)INSERT INTO a VALUES(1);INSERT INTO a VALUES(2);INSERT INTO ab VALUES(1);INSERT INTO ab VALUES(1);INSERT INTO ab VALUES(1);SELECT * FROM aSELECT * FROM a LEFT OUTER JOIN abON (a.a=ab.b)
The query result is:
1 1 1
211
311
42
The main purpose of recording this incident is to explain that the first response is not necessarily correct during work, when we are deeply immersed in it, we may wish to find an outsider to help us deal with it. It is called the viewer, ^ _ ^. During the discussion, we should also pay attention to the objective description of the problem and try not to drag our friends into the trap of thinking.
Connection references: http://liuzidong.iteye.com/blog/892319