What is it wrong about this simple SQL outer join?
select count(*) from A -- 25766
select count(*) from B -- 1242
select count(*) from A left outer join B on A.b = B.b -- 310176
return 25766, 1242 and 310176 rows respectively. (This is for Microsoft SQL Server 2012.) How can A left outer join B
ever return more rows than exist in A
, especially given this Venn diagram? I guess I'm making a stupid mistake but what is it?