inner join on both sides of the filter out of the null condition

Two days before the operation, I encountered a problem with regard to join on the query, check out the results have been very puzzled, recorded here.
1. First, look at the following this sql query:

Check out the result 25053

2. add o.lat = n.lat conditions:

Check out the result 15586

3. Now we will change the conditions o.lat! = N.lat, check out the result should show the difference 25053-15586 is not it?

We found that the results are not expected, but 125. Strange, the rest of the 25053-15586-125 = 9342 data where it went, how the query does not come out?

4. Look at the following this sql statement, we filter out cases o.lat and n.lat are empty:

9342! !
Aha, that was it, join on condition will filter out both sides are null values.
If the return left table is null data, can be used left join, the contrary, if the right to return null data in the table, using the right join.
inner join (may be abbreviated to join), the left and right of the table are not return null data.

Guess you like

Origin www.cnblogs.com/yaofengdoit/p/11936032.html