sql - How can A left outer join B return more rows than are in A? -


What is wrong about adding this simple SQL external?

Select count (*) from A - 25766 Selection count (*) to B - 1242 Selection count (*) from left AB = BB - 310176 < / Pre>

Returns 25766, 1242 and 310176 respectively, the row (this is for Microsoft SQL Server 2012). Comparison of Left External Part B Any time existing in A Can return more rows, especially the Wayne diagram? I think I'm making a stupid mistake but what is this?

This can happen when the column is not unique in the b table < Code> B . Suppose you have this data:

 a b + --- --- --- --- | B | B C. + --- --- ++ --- --- + | 1 | | 2 | 1 | | 2 | | 2 | 2 | + --- --- --- --- --- 

When you leave a to b column b Code>, you get

 + ----- + ------ + ------ + | A.B. | B.B. | B.C. + ----- + ------ + ------ + | 1 | Faucet Faucet | 2 | 2 | 1 | | 2 | 2 | 2 | Which is the only two rows in the +  b . 


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -